From 916b1c40ec96d0edc0a8e9a20569bcedcbe14c8b Mon Sep 17 00:00:00 2001 From: patchwork01 <110390516+patchwork01@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:01:46 +0000 Subject: [PATCH 1/2] Allow calling RunECSTasks for no tasks --- .../src/main/java/sleeper/task/common/RunECSTasks.java | 2 +- .../src/test/java/sleeper/task/common/RunECSTasksIT.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/java/common/common-task/src/main/java/sleeper/task/common/RunECSTasks.java b/java/common/common-task/src/main/java/sleeper/task/common/RunECSTasks.java index 51736335a8..959993867d 100644 --- a/java/common/common-task/src/main/java/sleeper/task/common/RunECSTasks.java +++ b/java/common/common-task/src/main/java/sleeper/task/common/RunECSTasks.java @@ -96,7 +96,7 @@ public void runTasksOrThrow() throws AmazonClientException { LOGGER.info("Creating {} tasks", numberOfTasksToCreate); try { int remainingTasks = numberOfTasksToCreate; - while (true) { + while (remainingTasks > 0) { try { remainingTasks = retryTaskUntilCapacityAvailable(remainingTasks); diff --git a/java/common/common-task/src/test/java/sleeper/task/common/RunECSTasksIT.java b/java/common/common-task/src/test/java/sleeper/task/common/RunECSTasksIT.java index 9da6a4d18d..e2413554a3 100644 --- a/java/common/common-task/src/test/java/sleeper/task/common/RunECSTasksIT.java +++ b/java/common/common-task/src/test/java/sleeper/task/common/RunECSTasksIT.java @@ -148,6 +148,15 @@ void shouldConsumeResults() { .extracting(RunTaskResponse::tasks, RunTaskResponse::failures) .containsExactly(tuple(List.of(), List.of())); } + + @Test + void shouldRunNoTasks() { + runTasksOrThrow(runTasks -> runTasks + .runTaskRequest(request -> request.cluster("test-cluster")) + .numberOfTasksToCreate(0)); + + verify(0, anyRequest()); + } } @Nested From 04dc7d0004d26a8642f1da48dcd40d442cae92ac Mon Sep 17 00:00:00 2001 From: patchwork01 <110390516+patchwork01@users.noreply.github.com> Date: Thu, 31 Oct 2024 15:03:51 +0000 Subject: [PATCH 2/2] Allow zero writers/ingests/records in system test task --- .../systemtest/configuration/SystemTestProperty.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java/system-test/system-test-configuration/src/main/java/sleeper/systemtest/configuration/SystemTestProperty.java b/java/system-test/system-test-configuration/src/main/java/sleeper/systemtest/configuration/SystemTestProperty.java index a8fbbf25b6..b92590eea6 100644 --- a/java/system-test/system-test-configuration/src/main/java/sleeper/systemtest/configuration/SystemTestProperty.java +++ b/java/system-test/system-test-configuration/src/main/java/sleeper/systemtest/configuration/SystemTestProperty.java @@ -109,13 +109,13 @@ public interface SystemTestProperty extends InstanceProperty { .build(); SystemTestProperty NUMBER_OF_WRITERS = Index.propertyBuilder("sleeper.systemtest.writers") .description("The number of containers that write random data") - .defaultValue("1").validationPredicate(SleeperPropertyValueUtils::isPositiveInteger).build(); + .defaultValue("1").validationPredicate(SleeperPropertyValueUtils::isNonNegativeInteger).build(); SystemTestProperty NUMBER_OF_INGESTS_PER_WRITER = Index.propertyBuilder("sleeper.systemtest.ingests.per.writer") .description("The number of ingests to run for each writer") - .defaultValue("1").validationPredicate(SleeperPropertyValueUtils::isPositiveInteger).build(); + .defaultValue("1").validationPredicate(SleeperPropertyValueUtils::isNonNegativeInteger).build(); SystemTestProperty NUMBER_OF_RECORDS_PER_INGEST = Index.propertyBuilder("sleeper.systemtest.records.per.ingest") .description("The number of random records that each ingest should write") - .defaultValue("100").validationPredicate(SleeperPropertyValueUtils::isPositiveInteger).build(); + .defaultValue("100").validationPredicate(SleeperPropertyValueUtils::isNonNegativeInteger).build(); SystemTestProperty MIN_RANDOM_INT = Index.propertyBuilder("sleeper.systemtest.random.int.min") .description("The minimum value of integers generated randomly during random record generation") .defaultValue("0").validationPredicate(SleeperPropertyValueUtils::isInteger).build();