You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ad...@apache.org on 2022/07/14 15:15:59 UTC

[cassandra] branch cassandra-4.1 updated: Fix flaky BatchUpgradeTest by waiting for clean system.batches

This is an automated email from the ASF dual-hosted git repository.

adelapena pushed a commit to branch cassandra-4.1
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-4.1 by this push:
     new 27a31f4cfa Fix flaky BatchUpgradeTest by waiting for clean system.batches
27a31f4cfa is described below

commit 27a31f4cfabb3faf65efc38ef866f7c1f78779ed
Author: Andrés de la Peña <a....@gmail.com>
AuthorDate: Tue Jul 12 15:31:21 2022 +0100

    Fix flaky BatchUpgradeTest by waiting for clean system.batches
    
    patch by Andrés de la Peña; reviewed by Brandon Williams and Berenguer Blasi for CASSANDRA-17651
---
 .../cassandra/distributed/upgrade/BatchUpgradeTest.java     | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java b/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java
index fb442331bf..db5e2e1278 100644
--- a/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java
+++ b/test/distributed/org/apache/cassandra/distributed/upgrade/BatchUpgradeTest.java
@@ -20,6 +20,7 @@ package org.apache.cassandra.distributed.upgrade;
 
 import org.junit.Test;
 
+import org.apache.cassandra.Util;
 import org.apache.cassandra.distributed.api.ConsistencyLevel;
 
 import static org.junit.Assert.assertEquals;
@@ -31,26 +32,24 @@ public class BatchUpgradeTest extends UpgradeTestBase
     {
         new TestCase()
         .nodes(2)
-
         .nodesToUpgrade(2)
         .upgradesFrom(v40).setup((cluster) -> {
-            cluster.schemaChange("CREATE TABLE "+KEYSPACE+".users (" +
+            cluster.schemaChange("CREATE TABLE " + KEYSPACE + ".users (" +
                                  "userid uuid PRIMARY KEY," +
                                  "firstname ascii," +
                                  "lastname ascii," +
                                  "age int) WITH COMPACT STORAGE");
         }).runAfterNodeUpgrade((cluster, node) -> {
             cluster.coordinator(2).execute("BEGIN BATCH\n" +
-                                           "    UPDATE "+KEYSPACE+".users SET age = 37 WHERE userid = f47ac10b-58cc-4372-a567-0e02b2c3d479\n" +
-                                           "    DELETE firstname, lastname FROM "+KEYSPACE+".users WHERE userid = 550e8400-e29b-41d4-a716-446655440000\n" +
+                                           "    UPDATE " + KEYSPACE + ".users SET age = 37 WHERE userid = f47ac10b-58cc-4372-a567-0e02b2c3d479\n" +
+                                           "    DELETE firstname, lastname FROM " + KEYSPACE + ".users WHERE userid = 550e8400-e29b-41d4-a716-446655440000\n" +
                                            "APPLY BATCH", ConsistencyLevel.ALL);
         }).runAfterClusterUpgrade((cluster) -> {
-            assertEquals(0, cluster.get(1).executeInternal("select * from system.batches").length);
-            assertEquals(0, cluster.get(2).executeInternal("select * from system.batches").length);
+            Util.spinAssertEquals(0, () -> cluster.get(1).executeInternal("select * from system.batches").length, 10);
+            Util.spinAssertEquals(0, () -> cluster.get(2).executeInternal("select * from system.batches").length, 10);
             assertEquals(0, cluster.get(1).logs().grep("ClassCastException").getResult().size());
             assertEquals(0, cluster.get(2).logs().grep("ClassCastException").getResult().size());
         })
         .run();
-
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org