func main() { cafe.SetLookupdHTTPAddrs(app.StringArray{}) cafe.Init() chef_todos.Init() api.GinEngine().Run(":8080") sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) go func() { select { case <-sigChan: log.Println("Exiting") cafe.StopAllConsumers() chef_todos.StopAllConsumers() log.Println("Done") os.Exit(0) } }() }
for _, file := range files { os.Remove(dir.Name() + "/" + file.Name()) } } var _ = BeforeSuite(func() { var err error RemoveDataFiles() dataPath := os.ExpandEnv("${GOPATH}/src/github.com/duskhacker/cqrsnu/data") command := exec.Command("nsqd", "--data-path="+dataPath, "--tcp-address=localhost:4150", "--http-address=localhost:4151", "--broadcast-address=localhost") serverSession, err = gexec.Start(command, GinkgoWriter, GinkgoWriter) Expect(err).ToNot(HaveOccurred()) Eventually(serverSession.Err, "2s").Should(gbytes.Say(`TCP: listening on`)) cafe.SetConnectToNSQD(true) cafe.SetNsqdTCPAddr("localhost:4150") ChefTodoList = []*todoListGroup{} cafe.Init() Init() }) var _ = AfterSuite(func() { cafe.StopAllConsumers() serverSession.Interrupt() gexec.CleanupBuildArtifacts() })