Skip to content

Commit

Permalink
Fix jacoco failure with new IT
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Dai <[email protected]>
  • Loading branch information
dai-chen committed Mar 18, 2024
1 parent a4747d1 commit 894aecc
Showing 1 changed file with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import static org.opensearch.sql.spark.execution.statestore.StateStore.DATASOURCE_TO_REQUEST_INDEX;
import static org.opensearch.sql.spark.flint.FlintIndexState.ACTIVE;
import static org.opensearch.sql.spark.flint.FlintIndexState.CANCELLING;
import static org.opensearch.sql.spark.flint.FlintIndexState.CREATING;
import static org.opensearch.sql.spark.flint.FlintIndexState.DELETED;
import static org.opensearch.sql.spark.flint.FlintIndexState.DELETING;
import static org.opensearch.sql.spark.flint.FlintIndexState.EMPTY;
Expand Down Expand Up @@ -57,7 +58,7 @@ public class IndexQuerySpecVacuumTest extends AsyncQueryExecutorServiceSpec {
"flint_mys3_default_http_logs_metrics"));

@Test
public void vacuumIndexInRefreshingState() {
public void shouldVacuumIndexInRefreshingState() {
List<List<Object>> testCases =
Lists.cartesianProduct(
FLINT_TEST_DATASETS,
Expand All @@ -84,7 +85,7 @@ public void vacuumIndexInRefreshingState() {
}

@Test
public void vacuumIndexInRefreshingStateButTimeout() {
public void shouldNotVacuumIndexInRefreshingStateIfCancelTimeout() {
List<List<Object>> testCases =
Lists.cartesianProduct(
FLINT_TEST_DATASETS,
Expand All @@ -105,7 +106,31 @@ public void vacuumIndexInRefreshingStateButTimeout() {
}

@Test
public void vacuumIndexInCancellingState() {
public void shouldNotVacuumIndexInCreatingState() {
List<List<Object>> testCases =
Lists.cartesianProduct(
FLINT_TEST_DATASETS,
List.of(CREATING),
List.of(
Pair.<EMRApiCall, EMRApiCall>of(
() -> {
throw new AssertionError("should not call cancelJobRun");
},
() -> {
throw new AssertionError("should not call getJobRunResult");
})));

runVacuumTestSuite(
testCases,
(mockDS, response) -> {
assertEquals("SUCCESS", response.getStatus());
assertTrue(flintIndexExists(mockDS.indexName));
assertTrue(indexDocExists(mockDS.latestId));
});
}

@Test
public void shouldVacuumIndexInCancellingState() {
List<List<Object>> testCases =
Lists.cartesianProduct(
FLINT_TEST_DATASETS,
Expand All @@ -125,7 +150,7 @@ public void vacuumIndexInCancellingState() {
}

@Test
public void vacuumIndexWithoutJobRunning() {
public void shouldVacuumIndexWithoutJobRunning() {
List<List<Object>> testCases =
Lists.cartesianProduct(
FLINT_TEST_DATASETS,
Expand Down

0 comments on commit 894aecc

Please sign in to comment.