Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@
import org.opensearch.secure_sm.AccessController;
import org.opensearch.test.OpenSearchIntegTestCase;
import org.junit.AfterClass;
import org.junit.Before;

import java.net.HttpURLConnection;
import java.util.Collection;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

import reactor.core.scheduler.Schedulers;

import static org.opensearch.test.OpenSearchTestCase.assertBusy;
import static org.hamcrest.Matchers.blankOrNullString;
import static org.hamcrest.Matchers.not;

Expand All @@ -65,6 +68,26 @@ public static void shutdownSchedulers() {
Schedulers.shutdownNow();
}

@Before
public void waitForAzureFixtureReady() throws Exception {
ensureGreen();

assertBusy(() -> {
assertThat(System.getProperty("test.azure.container"), not(blankOrNullString()));
assertThat(System.getProperty("test.azure.base"), not(blankOrNullString()));
}, 60, TimeUnit.SECONDS);
}

@Override
public void tearDown() throws Exception {
try {
client().admin().indices().prepareDelete("*").get();
client().admin().cluster().prepareDeleteRepository("_all").get();
} finally {
super.tearDown();
}
}

@Override
protected Collection<Class<? extends Plugin>> getPlugins() {
return pluginList(AzureRepositoryPlugin.class);
Expand Down Expand Up @@ -101,6 +124,12 @@ protected SecureSettings credentials() {
return secureSettings;
}

private <T> T eventually(Supplier<T> supplier) throws Exception {
final AtomicReference<T> result = new AtomicReference<>();
assertBusy(() -> result.set(supplier.get()), 30, TimeUnit.SECONDS);
return result.get();
}

@Override
protected void createRepository(String repoName) {
Settings.Builder settings = Settings.builder()
Expand Down
Loading