jacek-lewandowski commented on code in PR #2713:
URL: https://github.com/apache/cassandra/pull/2713#discussion_r1339921205
##########
test/unit/org/apache/cassandra/cql3/statements/DescribeStatementTest.java:
##########
@@ -377,6 +393,52 @@ public void testDescribe() throws Throwable
}
}
+ private static volatile CountDownLatch describeStatementLatch;
+ public static void awaitDescribeStatementLatch()
+ {
+ if (Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(ste
-> ste.getClassName().equals(DescribeStatement.class.getName())))
+ {
+ describeStatementLatch.decrement();
+ describeStatementLatch.awaitThrowUncheckedOnInterrupt();
+ }
+ }
+
+ @Test
+ @BMRule(name = "blablabla",
+ targetClass = "Schema",
+ targetMethod = "distributedAndLocalKeyspaces",
+ targetLocation = "AT ENTRY",
+ action =
"org.apache.cassandra.cql3.statements.DescribeStatementTest.awaitDescribeStatementLatch()")
+ public void testNotReturningPartiallyAppliedSchema() throws Throwable
+ {
+ describeStatementLatch = CountDownLatch.newCountDownLatch(2);
+ ForkJoinTask<ResultSet> describeFuture =
ForkJoinPool.commonPool().submit(() -> {
+ try
+ {
+ return executeNetWithPaging(ProtocolVersion.CURRENT, "DESCRIBE
KEYSPACES", 1);
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException(e);
+ }
+ });
+ // wait for the describe statement to be in progress
+ Awaitility.await().atMost(Duration.ofSeconds(5)).until(() ->
describeStatementLatch.count() == 1);
Review Comment:
changed to 20 seconds, it does not make sense to increase it more for those
tests. Also renamed "blablabla" rule 🤦🏻
##########
test/unit/org/apache/cassandra/cql3/statements/DescribeStatementTest.java:
##########
@@ -377,6 +393,52 @@ public void testDescribe() throws Throwable
}
}
+ private static volatile CountDownLatch describeStatementLatch;
+ public static void awaitDescribeStatementLatch()
+ {
+ if (Arrays.stream(Thread.currentThread().getStackTrace()).anyMatch(ste
-> ste.getClassName().equals(DescribeStatement.class.getName())))
+ {
+ describeStatementLatch.decrement();
+ describeStatementLatch.awaitThrowUncheckedOnInterrupt();
+ }
+ }
+
+ @Test
+ @BMRule(name = "blablabla",
+ targetClass = "Schema",
+ targetMethod = "distributedAndLocalKeyspaces",
+ targetLocation = "AT ENTRY",
+ action =
"org.apache.cassandra.cql3.statements.DescribeStatementTest.awaitDescribeStatementLatch()")
+ public void testNotReturningPartiallyAppliedSchema() throws Throwable
+ {
+ describeStatementLatch = CountDownLatch.newCountDownLatch(2);
+ ForkJoinTask<ResultSet> describeFuture =
ForkJoinPool.commonPool().submit(() -> {
+ try
+ {
+ return executeNetWithPaging(ProtocolVersion.CURRENT, "DESCRIBE
KEYSPACES", 1);
+ }
+ catch (Throwable e)
+ {
+ throw new RuntimeException(e);
+ }
+ });
+ // wait for the describe statement to be in progress
+ Awaitility.await().atMost(Duration.ofSeconds(5)).until(() ->
describeStatementLatch.count() == 1);
Review Comment:
changed to 20 seconds, it does not make sense to increase it more for those
tests. Also renamed "blablabla" rule 🤦🏻
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]