[ 
https://issues.apache.org/jira/browse/CASSANDRA-15308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17040529#comment-17040529
 ] 

Yifan Cai commented on CASSANDRA-15308:
---------------------------------------

I pushed a new commit to address the comments. [~benedict]

Comments are added to the test case to describe the what exactly the test does 
and what the result we expect. A testing method {{void 
unsafeReleaseCapacity(long count, long amount)}} was added to not looping 
release the remaining capacity. However, it need to be aware that it is a 
testing method that is located in the production scope. We already have several 
such methods declared in that class. 

Since they must only be used in test, potentially we can do the below assertion 
at the start of the methods annotated with {{VisibleForTesting}}, or make a new 
annotation that inserts the assertion. I did not add it in the code. Just 
mentioned here. 

{code:java}
assert Stream.of(Thread.currentThread().getStackTrace()).map(trace -> 
trace.getClassName().toLowerCase()).anyMatch(name -> name.contains("test"));
{code}



> Fix flakey testAcquireReleaseOutbound - 
> org.apache.cassandra.net.ConnectionTest
> -------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-15308
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15308
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/unit
>            Reporter: Joey Lynch
>            Assignee: Yifan Cai
>            Priority: Normal
>             Fix For: 4.0-alpha
>
>
> Example failure: 
> https://circleci.com/gh/jolynch/cassandra/554#tests/containers/61
> {noformat}
> Your job ran 4428 tests with 1 failure
> - testAcquireReleaseOutbound - org.apache.cassandra.net.ConnectionTest
> junit.framework.AssertionFailedError
>       at 
> org.apache.cassandra.net.ConnectionTest.lambda$testAcquireReleaseOutbound$53(ConnectionTest.java:770)
>       at 
> org.apache.cassandra.net.ConnectionTest.lambda$doTest$8(ConnectionTest.java:238)
>       at 
> org.apache.cassandra.net.ConnectionTest.doTestManual(ConnectionTest.java:258)
>       at 
> org.apache.cassandra.net.ConnectionTest.doTest(ConnectionTest.java:236)
>       at org.apache.cassandra.net.ConnectionTest.test(ConnectionTest.java:225)
>       at 
> org.apache.cassandra.net.ConnectionTest.testAcquireReleaseOutbound(ConnectionTest.java:767)
>  {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to