diff --git a/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java b/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java index 3db07b96610d4..bf0b56094c9aa 100644 --- a/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java +++ b/docs/src/test/java/org/elasticsearch/smoketest/DocsClientYamlTestSuiteIT.java @@ -108,8 +108,15 @@ public void waitForRequirements() throws Exception { } } + private static boolean snapshotRepositoryPopulated; + @Before public void populateSnapshotRepository() throws IOException { + + if (snapshotRepositoryPopulated) { + return; + } + // The repository UUID is only created on the first write to the repo, so it may or may not exist when running the tests. However to // include the output from the put-repository and get-repositories APIs in the docs we must be sure whether the UUID is returned or // not, so we prepare by taking a snapshot first to ensure that the UUID really has been created. @@ -128,6 +135,8 @@ public void populateSnapshotRepository() throws IOException { final Request deleteRepoRequest = new Request("DELETE", "/_snapshot/test_setup_repo"); assertOK(adminClient().performRequest(deleteRepoRequest)); + + snapshotRepositoryPopulated = true; } @After