Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable disabled PIT integration tests #3871

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Changes from 2 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 @@ -14,9 +14,9 @@
import com.carrotsearch.randomizedtesting.RandomizedRunner;
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -133,6 +133,23 @@ public static void createTestData() {
}
}

@Before
public void cleanUpPits() throws IOException {
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(ADMIN_USER)) {
GetAllPitNodesResponse existingPitsResponse = restHighLevelClient.getAllPits(DEFAULT);
if (!existingPitsResponse.getPitInfos().isEmpty()) {
try {
restHighLevelClient.deleteAllPits(DEFAULT);
} catch (OpenSearchStatusException ex) {
if (ex.status() != RestStatus.NOT_FOUND) {
peternied marked this conversation as resolved.
Show resolved Hide resolved
throw ex;
}
// tried to remove pits but no pit exists
}
}
}
}

@ClassRule
public static final LocalCluster cluster = new LocalCluster.Builder().clusterManager(ClusterManager.THREE_CLUSTER_MANAGERS)
.anonymousAuth(false)
Expand Down Expand Up @@ -180,11 +197,9 @@ public void createPitWithIndexAlias_negative() throws IOException {
}
}

@Ignore("Pretty sure cleanUpPits is returning before all of the PITs have actually been deleted")
@Test
public void listAllPits_positive() throws IOException {
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(POINT_IN_TIME_USER)) {
cleanUpPits();
String firstIndexPit = createPitForIndices(FIRST_SONG_INDEX);
String secondIndexPit = createPitForIndices(SECOND_SONG_INDEX);

Expand Down Expand Up @@ -247,11 +262,9 @@ public void deletePitCreatedWithIndexAlias_negative() throws IOException {
}
}

@Ignore("Pretty sure cleanUpPits is returning before all of the PITs have actually been deleted")
@Test
public void deleteAllPits_positive() throws IOException {
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(POINT_IN_TIME_USER)) {
cleanUpPits();
String firstIndexPit = createPitForIndices(FIRST_SONG_INDEX);
String secondIndexPit = createPitForIndices(SECOND_SONG_INDEX);

Expand Down Expand Up @@ -410,20 +423,4 @@ private String createPitForIndices(String... indices) throws IOException {
}
}

/**
* Deletes all PITs.
*/
public void cleanUpPits() throws IOException {
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(ADMIN_USER)) {
try {
restHighLevelClient.deleteAllPits(DEFAULT);
} catch (OpenSearchStatusException ex) {
if (ex.status() != RestStatus.NOT_FOUND) {
throw ex;
}
// tried to remove pits but no pit exists
}
}
}

}
Loading