(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestClusterAdminCreateTopicWithoutAuthorization(t *testing.T) { |
| 122 | seedBroker := NewMockBroker(t, 1) |
| 123 | defer seedBroker.Close() |
| 124 | |
| 125 | seedBroker.SetHandlerByMap(map[string]MockResponse{ |
| 126 | "MetadataRequest": NewMockMetadataResponse(t). |
| 127 | SetController(seedBroker.BrokerID()). |
| 128 | SetBroker(seedBroker.Addr(), seedBroker.BrokerID()), |
| 129 | "CreateTopicsRequest": NewMockCreateTopicsResponse(t), |
| 130 | }) |
| 131 | |
| 132 | config := NewTestConfig() |
| 133 | config.Version = V0_11_0_0 |
| 134 | |
| 135 | admin, err := NewClusterAdmin([]string{seedBroker.Addr()}, config) |
| 136 | if err != nil { |
| 137 | t.Fatal(err) |
| 138 | } |
| 139 | |
| 140 | err = admin.CreateTopic("_internal_topic", &TopicDetail{NumPartitions: 1, ReplicationFactor: 1}, false) |
| 141 | want := "insufficient permissions to create topic with reserved prefix" |
| 142 | if !strings.HasSuffix(err.Error(), want) { |
| 143 | t.Fatal(err) |
| 144 | } |
| 145 | err = admin.Close() |
| 146 | if err != nil { |
| 147 | t.Fatal(err) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func TestClusterAdminListTopics(t *testing.T) { |
| 152 | seedBroker := NewMockBroker(t, 1) |
nothing calls this directly
no test coverage detected