Example #1
0
func TestGexec(t *testing.T) {
	BeforeSuite(func() {
		var err error
		fireflyPath, err = gexec.Build("./_fixture/firefly")
		Ω(err).ShouldNot(HaveOccurred())
	})

	AfterSuite(func() {
		gexec.CleanupBuildArtifacts()
	})

	RegisterFailHandler(Fail)
	RunSpecs(t, "Gexec Suite")
}
	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()
})