DaveTeng0 commented on code in PR #3867:
URL: https://github.com/apache/ozone/pull/3867#discussion_r1001271796
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestCommandQueueReportHandler.java:
##########
@@ -77,35 +79,51 @@ public void resetEventCollector() throws IOException {
public void testQueueReportProcessed() throws NodeNotFoundException {
DatanodeDetails dn = MockDatanodeDetails.randomDatanodeDetails();
nodeManager.register(dn, null, null);
+
+ // Add some queued commands to be sent to the DN on this heartbeat. This
+ // means the real queued count will be the value reported plus the commands
+ // sent to the DN.
+ Map<SCMCommandProto.Type, Integer> commandsToBeSent = new HashMap<>();
+ commandsToBeSent.put(SCMCommandProto.Type.valueOf(1), 2);
+ commandsToBeSent.put(SCMCommandProto.Type.valueOf(2), 1);
+
SCMDatanodeHeartbeatDispatcher.CommandQueueReportFromDatanode
- commandReport = getQueueReport(dn);
+ commandReport = getQueueReport(dn, commandsToBeSent);
commandQueueReportHandler.onMessage(commandReport, this);
int commandCount = commandReport.getReport().getCommandCount();
for (int i = 0; i < commandCount; i++) {
int storedCount = nodeManager.getNodeQueuedCommandCount(dn,
commandReport.getReport().getCommand(i));
- Assertions.assertEquals(commandReport.getReport().getCount(i),
- storedCount);
+ int expectedCount = commandReport.getReport().getCount(i);
+ // For the first two commands, we added extra commands
Review Comment:
Hello Stephen! Just for my self-learning, why the first two commands we add
extra commands~? Thanks~ :pray:
--
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]