chia7712 commented on code in PR #18926:
URL: https://github.com/apache/kafka/pull/18926#discussion_r1996245505
##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java:
##########
@@ -920,10 +917,10 @@ public void
testInitializeAsUnattachedAndBecomeLeader(boolean withKip853Rpc) thr
RecordBatch batch = records.batches().iterator().next();
assertTrue(batch.isControlBatch());
- Record record = batch.iterator().next();
- assertEquals(electionTimestamp, record.timestamp());
+ Record expectedRecord = batch.iterator().next();
Review Comment:
Out of curiosity, what are the specific benefits associated with renaming it?
##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java:
##########
@@ -969,10 +966,10 @@ public void
testInitializeAsCandidateAndBecomeLeaderQuorumOfThree(boolean withKi
RecordBatch batch = records.batches().iterator().next();
assertTrue(batch.isControlBatch());
- Record record = batch.iterator().next();
- assertEquals(electionTimestamp, record.timestamp());
+ Record expectedRecord = batch.iterator().next();
Review Comment:
ditto
##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java:
##########
@@ -4030,24 +4027,17 @@ public void testMetrics(boolean withKip853Rpc) throws
Exception {
.build();
context.pollUntil(() -> context.log.endOffset().offset() == 1L);
- assertNotNull(getMetric(context.metrics, "current-state"));
- assertNotNull(getMetric(context.metrics, "current-leader"));
- assertNotNull(getMetric(context.metrics, "current-vote"));
- assertNotNull(getMetric(context.metrics, "current-epoch"));
- assertNotNull(getMetric(context.metrics, "high-watermark"));
- assertNotNull(getMetric(context.metrics, "log-end-offset"));
- assertNotNull(getMetric(context.metrics, "log-end-epoch"));
- assertNotNull(getMetric(context.metrics,
"number-unknown-voter-connections"));
- assertNotNull(getMetric(context.metrics, "poll-idle-ratio-avg"));
- assertNotNull(getMetric(context.metrics, "commit-latency-avg"));
- assertNotNull(getMetric(context.metrics, "commit-latency-max"));
- assertNotNull(getMetric(context.metrics, "election-latency-avg"));
- assertNotNull(getMetric(context.metrics, "election-latency-max"));
- assertNotNull(getMetric(context.metrics, "fetch-records-rate"));
- assertNotNull(getMetric(context.metrics, "append-records-rate"));
- assertNotNull(getMetric(context.metrics, "number-of-voters"));
- assertNotNull(getMetric(context.metrics, "number-of-observers"));
- assertNotNull(getMetric(context.metrics, "uncommitted-voter-change"));
+ List<String> metricNames = Arrays.asList(
Review Comment:
```
var metricNames = Set.of(
"current-state", "current-leader", "current-vote",
"current-epoch", "high-watermark",
"log-end-offset", "log-end-epoch",
"number-unknown-voter-connections", "poll-idle-ratio-avg",
"commit-latency-avg", "commit-latency-max",
"election-latency-avg", "election-latency-max",
"fetch-records-rate", "append-records-rate",
"number-of-voters", "number-of-observers",
"uncommitted-voter-change"
);
```
##########
raft/src/test/java/org/apache/kafka/raft/KafkaRaftClientTest.java:
##########
@@ -3968,10 +3965,10 @@ public void testLeaderAppendSingleMemberQuorum(boolean
withKip853Rpc) throws Exc
List<Record> readRecords = Utils.toList(leaderChangeBatch.iterator());
assertEquals(1, readRecords.size());
- Record record = readRecords.get(0);
- assertEquals(now, record.timestamp());
+ Record expectedRecord = readRecords.get(0);
Review Comment:
ditto
--
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]