MCPcopy
hub / github.com/segmentio/kafka-go / TestExtractTopics

Function TestExtractTopics

reader_test.go:722–790  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

720}
721
722func TestExtractTopics(t *testing.T) {
723 testCases := map[string]struct {
724 Members []GroupMember
725 Topics []string
726 }{
727 "nil": {},
728 "single member, single topic": {
729 Members: []GroupMember{
730 {
731 ID: "a",
732 Topics: []string{"topic"},
733 },
734 },
735 Topics: []string{"topic"},
736 },
737 "two members, single topic": {
738 Members: []GroupMember{
739 {
740 ID: "a",
741 Topics: []string{"topic"},
742 },
743 {
744 ID: "b",
745 Topics: []string{"topic"},
746 },
747 },
748 Topics: []string{"topic"},
749 },
750 "two members, two topics": {
751 Members: []GroupMember{
752 {
753 ID: "a",
754 Topics: []string{"topic-1"},
755 },
756 {
757 ID: "b",
758 Topics: []string{"topic-2"},
759 },
760 },
761 Topics: []string{"topic-1", "topic-2"},
762 },
763 "three members, three shared topics": {
764 Members: []GroupMember{
765 {
766 ID: "a",
767 Topics: []string{"topic-1", "topic-2"},
768 },
769 {
770 ID: "b",
771 Topics: []string{"topic-2", "topic-3"},
772 },
773 {
774 ID: "c",
775 Topics: []string{"topic-3", "topic-1"},
776 },
777 },
778 Topics: []string{"topic-1", "topic-2", "topic-3"},
779 },

Callers

nothing calls this directly

Calls 1

extractTopicsFunction · 0.85

Tested by

no test coverage detected