MetadataRetries: 30, WaitForElection: time.Second, }) Expect(err).NotTo(HaveOccurred()) subject, err = NewConsumerGroup(client, zk, tnG, tnT, nil, consumerConfig) Expect(err).NotTo(HaveOccurred()) }) AfterEach(func() { if subject != nil { subject.Close() subject = nil } if client != nil { client.Close() client = nil } if zk != nil { zk.Close() zk = nil } }) It("can be created & closed", func() { lst, _, err := zk.Consumers(tnG) Expect(err).NotTo(HaveOccurred()) Expect(lst).To(HaveLen(1)) Expect(subject.Close()).To(BeNil()) subject = nil })
func unmountOnInt(c chan os.Signal, server *fuse.Server, client *sarama.Client) { s := <-c fmt.Println("Got signal:", s) server.Unmount() client.Close() }
testClient, err = sarama.NewClient(testKafkaAddrs, nil) return err }, "10s", "1s").ShouldNot(HaveOccurred()) // Ensure we can retrieve partition info Eventually(func() error { _, err := testClient.Partitions(testTopics[0]) return err }, "10s", "500ms").ShouldNot(HaveOccurred()) // Seed a few messages Expect(testSeed(1000)).NotTo(HaveOccurred()) }) var _ = AfterSuite(func() { _ = testClient.Close() _ = testKafkaCmd.Process.Kill() _ = testZkCmd.Process.Kill() _ = testKafkaCmd.Wait() _ = testZkCmd.Wait() _ = os.RemoveAll(testKafkaData) }) // -------------------------------------------------------------------- func TestSuite(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "sarama/cluster") }