Пример #1
0
var _ = Describe("StemcellTracker", func() {

	var (
		session *gexec.Session
		host    string
	)

	BeforeEach(func() {
		port := "8282"
		host = fmt.Sprintf("http://localhost:%s", port)
		err := os.Setenv("PORT", port)
		Expect(err).ShouldNot(HaveOccurred())

		command := exec.Command(pathToBinary)
		session, err = gexec.Start(command, GinkgoWriter, GinkgoWriter)
		Expect(err).ShouldNot(HaveOccurred())
		time.Sleep(1 * time.Second)
	})

	AfterEach(func() {
		session.Terminate().Wait()
	})

	It("PUTs then GETs the latest stemcell for the given products", func() {

		products := map[string]string{
			"cf-mysql":   "3026",
			"cf-riak-cs": "3030",
		}
Пример #2
0
var _ = Describe("Interrupt", func() {
	var pathToTest string
	BeforeEach(func() {
		pathToTest = tmpPath("hanging")
		copyIn("hanging_suite", pathToTest)
	})

	Context("when interrupting a suite", func() {
		var session *gexec.Session
		BeforeEach(func() {
			//we need to signal the actual process, so we must compile the test first
			var err error
			cmd := exec.Command("go", "test", "-c")
			cmd.Dir = pathToTest
			session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
			Ω(err).ShouldNot(HaveOccurred())
			Eventually(session).Should(gexec.Exit(0))

			//then run the compiled test directly
			cmd = exec.Command("./hanging.test", "--test.v=true", "--ginkgo.noColor")
			cmd.Dir = pathToTest
			session, err = gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
			Ω(err).ShouldNot(HaveOccurred())

			Eventually(session).Should(gbytes.Say("Sleeping..."))
			session.Interrupt()
			Eventually(session, 1000).Should(gexec.Exit(1))
		})

		It("should emit the contents of the GinkgoWriter", func() {
func startGinkgo(dir string, args ...string) *gexec.Session {
	cmd := ginkgoCommand(dir, args...)
	session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
	Ω(err).ShouldNot(HaveOccurred())
	return session
}