From a13eb665718be7656b8b2bfe04d6774ec4f26025 Mon Sep 17 00:00:00 2001 From: Alexander Dejanovski Date: Tue, 31 Aug 2021 15:28:32 +0200 Subject: [PATCH] Fix flaky integration test --- .github/workflows/ci.yaml | 38 ++++++++++++++++--- .../acceptance/BasicSteps.java | 35 +++++++++-------- 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e04f04c4a..1313bbb14 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -131,21 +131,28 @@ jobs: cassandra-version: [1.2.19, 2.0.17, 2.1.22, 2.2.19, 3.0.25, 3.11.11, 4.0.0, 'github:apache/trunk'] storage-type: [local] test-type: [ccm] - experimental: [false] include: # don't run against the following C* versions when using cassandra storage type - cassandra-version: 1.2.19 cucumber-options: '--tags ~@cassandra_2_1_onwards --tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.0.17 cucumber-options: '--tags ~@cassandra_2_1_onwards --tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.1.22 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.2.19 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.0.25 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.11.11 cucumber-options: '--tags ~@cassandra_4_0_onwards' + experimental: false + - cassandra-version: 4.0.0 + experimental: false - cassandra-version: 'github:apache/trunk' experimental: true steps: @@ -313,16 +320,21 @@ jobs: cassandra-version: [2.1.22, 2.2.19, 3.0.25, 3.11.11, 4.0.0, 'github:apache/trunk'] storage-type: [cassandra] test-type: [ccm] - experimental: [false] include: - cassandra-version: 2.1.22 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.2.19 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.0.25 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.11.11 cucumber-options: '--tags ~@cassandra_4_0_onwards' + experimental: false + - cassandra-version: 4.0.0 + experimental: false - cassandra-version: 'github:apache/trunk' experimental: true steps: @@ -467,19 +479,23 @@ jobs: test-type: [sidecar] grim-max: [1] grim-min: [1] - experimental: [false] # all versions but trunk have the same cucumber options, but we can't declare that more effectively (yet) include: - cassandra-version: 2.1.22 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.2.19 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.0.25 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.11.11 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags @sidecar' + experimental: false - cassandra-version: 4.0.0 cucumber-options: '--tags @sidecar' + experimental: false - cassandra-version: 'github:apache/trunk' cucumber-options: '--tags @sidecar' experimental: true @@ -579,11 +595,11 @@ jobs: test-type: [each] grim-max: [1] grim-min: [1] - experimental: [false] # Reduced scope to shorten the integration test times include: - cassandra-version: 4.0.0 cucumber-options: '--tags @sidecar' + experimental: false - cassandra-version: 'github:apache/trunk' cucumber-options: '--tags @sidecar' experimental: true @@ -659,17 +675,22 @@ jobs: test-type: [ccm] grim-max: [2] grim-min: [2] - experimental: [false] include: # all versions but trunk need to exclude trunk tests - cassandra-version: 2.1.22 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.2.19 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.0.25 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.11.11 cucumber-options: '--tags ~@cassandra_4_0_onwards' + experimental: false + - cassandra-version: 4.0.0 + experimental: false - cassandra-version: 'github:apache/trunk' experimental: true steps: @@ -742,17 +763,22 @@ jobs: test-type: [ccm] grim-max: [4] grim-min: [2] - experimental: [false] include: # all versions but trunk need to exclude trunk tests - cassandra-version: 2.1.22 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 2.2.19 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.0.25 cucumber-options: '--tags ~@cassandra_4_0_onwards --tags ~@cassandra_3_11_onwards' + experimental: false - cassandra-version: 3.11.11 cucumber-options: '--tags ~@cassandra_4_0_onwards' + experimental: false + - cassandra-version: 4.0.0 + experimental: false - cassandra-version: 'github:apache/trunk' experimental: true steps: diff --git a/src/server/src/test/java/io/cassandrareaper/acceptance/BasicSteps.java b/src/server/src/test/java/io/cassandrareaper/acceptance/BasicSteps.java index 885cad700..8d0e8154b 100644 --- a/src/server/src/test/java/io/cassandrareaper/acceptance/BasicSteps.java +++ b/src/server/src/test/java/io/cassandrareaper/acceptance/BasicSteps.java @@ -1286,26 +1286,25 @@ public void a_new_daily_repair_schedule_is_added_that_already_exists_with_force_ String keyspace) throws Throwable { synchronized (BasicSteps.class) { - RUNNERS.parallelStream().forEach(runner -> { - Map params = Maps.newHashMap(); - params.put("clusterName", clusterName); - params.put("keyspace", keyspace); - params.put("owner", TestContext.TEST_USER); - params.put("intensity", "0.9"); - params.put("scheduleDaysBetween", "1"); - params.put("repairParallelism", repairType.equals("incremental") ? "parallel" : "sequential"); - params.put("incrementalRepair", repairType.equals("incremental") ? "True" : "False"); - params.put("force", "true"); - Response response = runner.callReaper("POST", "/repair_schedule", Optional.of(params)); + ReaperTestJettyRunner runner = RUNNERS.get(RAND.nextInt(RUNNERS.size())); + Map params = Maps.newHashMap(); + params.put("clusterName", clusterName); + params.put("keyspace", keyspace); + params.put("owner", TestContext.TEST_USER); + params.put("intensity", "0.9"); + params.put("scheduleDaysBetween", "1"); + params.put("repairParallelism", repairType.equals("incremental") ? "parallel" : "sequential"); + params.put("incrementalRepair", repairType.equals("incremental") ? "True" : "False"); + params.put("force", "true"); + Response response = runner.callReaper("POST", "/repair_schedule", Optional.of(params)); - int status = response.getStatus(); - String responseEntity = response.readEntity(String.class); + int status = response.getStatus(); + String responseEntity = response.readEntity(String.class); - Assertions.assertThat( - ImmutableList.of(Response.Status.NO_CONTENT.getStatusCode(), Response.Status.CREATED.getStatusCode())) - .withFailMessage(responseEntity) - .contains(status); - }); + Assertions.assertThat( + ImmutableList.of(Response.Status.CREATED.getStatusCode())) + .withFailMessage(responseEntity) + .contains(status); } }