Skip to content

Commit

Permalink
Remove repository wipe
Browse files Browse the repository at this point in the history
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Sep 1, 2023
1 parent dddf695 commit d0af9e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2402,26 +2402,11 @@ public final void setupTestCluster() throws Exception {
beforeInternal();
printTestMessage("all set up");
}
assertRepositoryMetadataPresentInClusterState();
if(getNumDataNodes() == 0) {
internalCluster().stopRandomDataNode();
}
}

void assertRepositoryMetadataPresentInClusterState() throws Exception {
assertBusy(() -> {
RepositoriesMetadata repositoriesMetadata = client().admin()
.cluster()
.prepareState()
.get()
.getState()
.metadata()
.custom(RepositoriesMetadata.TYPE);
assertTrue(repositoriesMetadata != null && !repositoriesMetadata.repositories().isEmpty());
}, 30, TimeUnit.SECONDS);
}


@After
public final void cleanUpCluster() throws Exception {
// Deleting indices is going to clear search contexts implicitly so we
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ public void wipe(Set<String> excludeTemplates) {
wipeAllDataStreams();
wipeIndices("_all");
wipeAllTemplates(excludeTemplates);
GetRepositoriesResponse response = client().admin().cluster().prepareGetRepositories("*").execute().actionGet();
List<String> allRepositories = response.repositories().stream().map(RepositoryMetadata::name).collect(Collectors.toList());
wipeRepositories(allRepositories);
wipeRepositories();
}

/**
Expand Down Expand Up @@ -247,12 +245,13 @@ public void wipeTemplates(String... templates) {
}
}

/**
* Deletes repositories, supports wildcard notation.
*/
public void wipeRepositories(List<String> allRepositories) {
public void wipeRepositories(String... repositories) {
if (size() > 0) {
for (String repository : allRepositories) {
// if nothing is provided, delete all
if (repositories.length == 0) {
repositories = new String[] { "*" };
}
for (String repository : repositories) {
try {
client().admin().cluster().prepareDeleteRepository(repository).execute().actionGet();
} catch (RepositoryMissingException ex) {
Expand Down

0 comments on commit d0af9e3

Please sign in to comment.