(t *testing.T)
| 19 | } |
| 20 | |
| 21 | func TestListRe(t *testing.T) { |
| 22 | client, shutdown := newLocalClientWithTopic("TestTopics-A", 1) |
| 23 | defer shutdown() |
| 24 | clientCreateTopic(client, "TestTopics-B", 1) |
| 25 | |
| 26 | allRegex := regexp.MustCompile("TestTopics-.*") |
| 27 | fooRegex := regexp.MustCompile("TestTopics-B") |
| 28 | |
| 29 | // Get all the topics |
| 30 | topics, err := ListRe(context.Background(), client, allRegex) |
| 31 | if err != nil { |
| 32 | t.Fatal(err) |
| 33 | } |
| 34 | if len(topics) != 2 { |
| 35 | t.Error("the wrong number of topics were returned. ", len(topics)) |
| 36 | } |
| 37 | |
| 38 | // Get one topic |
| 39 | topics, err = ListRe(context.Background(), client, fooRegex) |
| 40 | if err != nil { |
| 41 | t.Fatal(err) |
| 42 | } |
| 43 | if len(topics) != 1 { |
| 44 | t.Error("the wrong number of topics were returned. ", len(topics)) |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | func newLocalClientWithTopic(topic string, partitions int) (*kafka.Client, func()) { |
| 49 | client, shutdown := newLocalClient() |
nothing calls this directly
no test coverage detected