This is an automated email from the ASF dual-hosted git repository.
jsancio pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 887d05559f3 MINOR: Create only one FeatureControlManager instance in
ReplicationControlManagerTest (#13468)
887d05559f3 is described below
commit 887d05559f36fee94389988405724b509a84c46c
Author: andymg3 <[email protected]>
AuthorDate: Wed Mar 29 22:10:03 2023 -0400
MINOR: Create only one FeatureControlManager instance in
ReplicationControlManagerTest (#13468)
This is a small patch to make it so we only create one
FeatureControlManager instance in ReplicationControlManagerTest. Currently we
create two, which isn't needed. Its also a bit confusing because the
ReplicationControlTestContext objects ends up having a different
FeatureControlManager reference that the one its own ReplicationControlManager
instance has a reference to.
Reviewers: José Armando García Sancio <[email protected]>, dengziming
<[email protected]>
---
.../controller/ReplicationControlManagerTest.java | 27 +++++++++-------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git
a/metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java
b/metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java
index a1ee29bfe2b..6aa4fe508db 100644
---
a/metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java
+++
b/metadata/src/test/java/org/apache/kafka/controller/ReplicationControlManagerTest.java
@@ -156,21 +156,8 @@ public class ReplicationControlManagerTest {
final LogContext logContext = new LogContext();
final MockTime time = new MockTime();
final MockRandom random = new MockRandom();
- final FeatureControlManager featureControl = new
FeatureControlManager.Builder().
- setSnapshotRegistry(snapshotRegistry).
- setQuorumFeatures(new QuorumFeatures(0, new ApiVersions(),
- QuorumFeatures.defaultFeatureMap(),
- Collections.singletonList(0))).
- setMetadataVersion(MetadataVersion.latest()).
- build();
- final ClusterControlManager clusterControl = new
ClusterControlManager.Builder().
- setLogContext(logContext).
- setTime(time).
- setSnapshotRegistry(snapshotRegistry).
-
setSessionTimeoutNs(TimeUnit.MILLISECONDS.convert(BROKER_SESSION_TIMEOUT_MS,
TimeUnit.NANOSECONDS)).
- setReplicaPlacer(new StripedReplicaPlacer(random)).
- setFeatureControlManager(featureControl).
- build();
+ final FeatureControlManager featureControl;
+ final ClusterControlManager clusterControl;
final ConfigurationControlManager configurationControl = new
ConfigurationControlManager.Builder().
setSnapshotRegistry(snapshotRegistry).
build();
@@ -195,13 +182,21 @@ public class ReplicationControlManagerTest {
}
ReplicationControlTestContext(MetadataVersion metadataVersion,
Optional<CreateTopicPolicy> createTopicPolicy) {
- FeatureControlManager featureControl = new
FeatureControlManager.Builder().
+ this.featureControl = new FeatureControlManager.Builder().
setSnapshotRegistry(snapshotRegistry).
setQuorumFeatures(new QuorumFeatures(0, new ApiVersions(),
QuorumFeatures.defaultFeatureMap(),
Collections.singletonList(0))).
setMetadataVersion(metadataVersion).
build();
+ this.clusterControl = new ClusterControlManager.Builder().
+ setLogContext(logContext).
+ setTime(time).
+ setSnapshotRegistry(snapshotRegistry).
+
setSessionTimeoutNs(TimeUnit.MILLISECONDS.convert(BROKER_SESSION_TIMEOUT_MS,
TimeUnit.NANOSECONDS)).
+ setReplicaPlacer(new StripedReplicaPlacer(random)).
+ setFeatureControlManager(featureControl).
+ build();
this.replicationControl = new ReplicationControlManager.Builder().
setSnapshotRegistry(snapshotRegistry).