Skip to content

[fix][test] Fix flaky test ResourceGroupUsageAggregationTest. testProduceConsumeUsageOnRG - #17617

Merged
Technoboy- merged 3 commits into
apache:masterfrom
Technoboy-:fix-17120
Sep 16, 2022
Merged

Technoboy- merged 3 commits into
apache:masterfrom
Technoboy-:fix-17120

Conversation

@Technoboy-

Copy link
Copy Markdown
Contributor

Fixes #17120
Master Issue: #17120

Motivation

The failure assertion is at line 206 :

Assert.assertEquals(recvdNumMsgs, topicStats.msgOutCounter);

recvdNumMsgs must be 10, but topicStats.msgOutCounter is from broker side, coming from dispatcher :

writeAndFlushPromise.addListener(status -> {
            // only increment counters after the messages have been successfully written to the TCP/IP connection
            if (status.isSuccess()) {
                msgOut.recordMultipleEvents(totalMessages, totalBytes);
                msgOutCounter.add(totalMessages);
                bytesOutCounter.add(totalBytes);
                chunkedMessageRate.recordMultipleEvents(totalChunkedMessages, 0);
            }
        });

So we need to use Awaitility for that assertion.

Modification

  • Remove for block, use Map.get.
  • Add cleanup logic in order to run the test many times.

Documentation

  • doc-not-needed
    (Please explain why)

@Technoboy- Technoboy- self-assigned this Sep 13, 2022
@Technoboy- Technoboy- added this to the 2.12.0 milestone Sep 13, 2022
@Technoboy- Technoboy- added type/flaky-tests doc-not-needed Your PR changes do not impact docs labels Sep 13, 2022
@Technoboy- Technoboy- closed this Sep 14, 2022
@Technoboy- Technoboy- reopened this Sep 14, 2022
@Technoboy-
Technoboy- merged commit fac14fb into apache:master Sep 16, 2022
@Technoboy- Technoboy- modified the milestones: 2.12.0, 2.11.0 Sep 28, 2022
Technoboy- added a commit that referenced this pull request Sep 28, 2022
@Technoboy-
Technoboy- deleted the fix-17120 branch September 14, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky-test: ResourceGroupUsageAggregationTest.testProduceConsumeUsageOnRG

3 participants