You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sa...@apache.org on 2020/09/09 10:58:32 UTC
[cassandra] branch trunk updated: Fix racey assertions in
ActiveRepairServiceTest
This is an automated email from the ASF dual-hosted git repository.
samt 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 c6fc671 Fix racey assertions in ActiveRepairServiceTest
c6fc671 is described below
commit c6fc6714eea73d94e6befd13b52a15cd48e28f7a
Author: Sam Tunnicliffe <sa...@beobal.com>
AuthorDate: Thu Sep 3 11:54:06 2020 +0100
Fix racey assertions in ActiveRepairServiceTest
Patch by Sam Tunnicliffe; reviewed by Ekaterina Dimitrova
for CASSANDRA-16034
---
.../org/apache/cassandra/service/ActiveRepairServiceTest.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/test/unit/org/apache/cassandra/service/ActiveRepairServiceTest.java b/test/unit/org/apache/cassandra/service/ActiveRepairServiceTest.java
index 45e55c3..d0a367a 100644
--- a/test/unit/org/apache/cassandra/service/ActiveRepairServiceTest.java
+++ b/test/unit/org/apache/cassandra/service/ActiveRepairServiceTest.java
@@ -37,6 +37,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.apache.cassandra.SchemaLoader;
+import org.apache.cassandra.Util;
import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor;
import org.apache.cassandra.config.Config;
import org.apache.cassandra.config.DatabaseDescriptor;
@@ -426,9 +427,12 @@ public class ActiveRepairServiceTest
// Make sure all tasks have been submitted to the validation executor
allSubmitted.await(10, TimeUnit.SECONDS);
- // 2 threads actively processing tasks
+ // Give the tasks we expect to execute immediately chance to be scheduled
+ Util.spinAssertEquals(2 , ((DebuggableThreadPoolExecutor) validationExecutor)::getActiveTaskCount, 1);
+ Util.spinAssertEquals(3 , ((DebuggableThreadPoolExecutor) validationExecutor)::getPendingTaskCount, 1);
+
+ // verify that we've reached a steady state with 2 threads actively processing and 3 queued tasks
Assert.assertEquals(2, ((DebuggableThreadPoolExecutor) validationExecutor).getActiveTaskCount());
- // 3 tasks queued
Assert.assertEquals(3, ((DebuggableThreadPoolExecutor) validationExecutor).getPendingTaskCount());
// allow executing tests to complete
blocked.signalAll();
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org