Skip to content
Merged
Changes from 1 commit
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
15 changes: 15 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,9 @@
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.stream.Collectors;

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

@Test
public void testDisplayTags() {
List<String> tags = Collections.singletonList("example tag");
ClusterConfig clusterConfig = ClusterConfig.defaultBuilder().setTags(tags).build();

Set<String> expectedDisplayTags = new LinkedHashSet<>(tags);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This testing code is almost same with production code. Maybe we don't need to verify the "format" of display tags. Instead, we check the output which should "contain" expected strings. WDYT?

@caysony1 caysony1 Jun 4, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@chia7712 Thanks for the review. I addressed the comments in my latest commit.

expectedDisplayTags.add("MetadataVersion=" + MetadataVersion.latestTesting());
expectedDisplayTags.add("Security=" + SecurityProtocol.PLAINTEXT);

Assertions.assertEquals(expectedDisplayTags, clusterConfig.displayTags());
}
}