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 <jsancio@apache.org>, dengziming <dengziming1993@gmail.com>
This commit is contained in:
andymg3 2023-03-29 22:10:03 -04:00 committed by GitHub
parent 5c0e4aa676
commit 887d05559f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 16 deletions

View File

@ -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).