You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by br...@apache.org on 2020/03/11 15:49:28 UTC

[cassandra] branch trunk updated: Wait for async abort to finish in StreamTransferTaskTest

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

brandonwilliams pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 95224b7  Wait for async abort to finish in StreamTransferTaskTest
95224b7 is described below

commit 95224b71e19e2b7f18596da070937291f040f695
Author: Brandon Williams <br...@apache.org>
AuthorDate: Wed Feb 12 17:47:53 2020 -0600

    Wait for async abort to finish in StreamTransferTaskTest
    
    Patch by brandonwilliams, reviewed by Dinesh Joshi for CASSANDRA-15550
---
 .../apache/cassandra/streaming/StreamTransferTaskTest.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/test/unit/org/apache/cassandra/streaming/StreamTransferTaskTest.java b/test/unit/org/apache/cassandra/streaming/StreamTransferTaskTest.java
index 80607c5..2361125 100644
--- a/test/unit/org/apache/cassandra/streaming/StreamTransferTaskTest.java
+++ b/test/unit/org/apache/cassandra/streaming/StreamTransferTaskTest.java
@@ -34,6 +34,7 @@ import org.junit.Test;
 import io.netty.channel.embedded.EmbeddedChannel;
 import org.junit.Assert;
 import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.concurrent.ScheduledExecutors;
 import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.db.Keyspace;
 import org.apache.cassandra.db.streaming.CassandraOutgoingFile;
@@ -169,6 +170,16 @@ public class StreamTransferTaskTest
             assertEquals(1, ref.globalCount());
         }
 
+        //wait for stream to abort asynchronously
+        int tries = 10;
+        while (ScheduledExecutors.nonPeriodicTasks.getActiveCount() > 0)
+        {
+            if(tries < 1)
+                throw new RuntimeException("test did not complete in time");
+            Thread.sleep(10);
+            tries--;
+        }
+
         //simulate finish transfer
         for (OutgoingStreamMessage file : files)
         {


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