Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: Added test for ClusterConfig #16110

Merged
merged 6 commits into from
Jun 6, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions core/src/test/java/kafka/test/ClusterConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.Map;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -96,4 +98,16 @@ public void testDisksPerBrokerIsZero() {
.setDisksPerBroker(0)
.build());
}

@Test
public void testDisplayTags() {
List<String> tags = Collections.singletonList("tag");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use multi tags and then verify all of them are existent in displayTags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chia7712 I addressed multi tags in my latest commit.

ClusterConfig clusterConfig = ClusterConfig.defaultBuilder().setTags(tags).build();

Set<String> expectedDisplayTags = clusterConfig.displayTags();

Assertions.assertTrue(expectedDisplayTags.contains("tag"));
Assertions.assertTrue(expectedDisplayTags.contains("MetadataVersion=" + MetadataVersion.latestTesting()));
Assertions.assertTrue(expectedDisplayTags.contains("Security=" + SecurityProtocol.PLAINTEXT));
}
}