precompiled_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package integration_test
  2. import (
  3. "os"
  4. "os/exec"
  5. "path/filepath"
  6. . "github.com/onsi/ginkgo"
  7. . "github.com/onsi/gomega"
  8. "github.com/onsi/gomega/gbytes"
  9. "github.com/onsi/gomega/gexec"
  10. )
  11. var _ = Describe("ginkgo build", func() {
  12. var pathToTest string
  13. BeforeEach(func() {
  14. pathToTest = tmpPath("passing_ginkgo_tests")
  15. copyIn("passing_ginkgo_tests", pathToTest)
  16. session := startGinkgo(pathToTest, "build")
  17. Eventually(session).Should(gexec.Exit(0))
  18. output := string(session.Out.Contents())
  19. Ω(output).Should(ContainSubstring("Compiling passing_ginkgo_tests"))
  20. Ω(output).Should(ContainSubstring("compiled passing_ginkgo_tests.test"))
  21. })
  22. It("should build a test binary", func() {
  23. _, err := os.Stat(filepath.Join(pathToTest, "passing_ginkgo_tests.test"))
  24. Ω(err).ShouldNot(HaveOccurred())
  25. })
  26. It("should be possible to run the test binary directly", func() {
  27. cmd := exec.Command("./passing_ginkgo_tests.test")
  28. cmd.Dir = pathToTest
  29. session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter)
  30. Ω(err).ShouldNot(HaveOccurred())
  31. Eventually(session).Should(gexec.Exit(0))
  32. Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite"))
  33. })
  34. It("should be possible to run the test binary via ginkgo", func() {
  35. session := startGinkgo(pathToTest, "./passing_ginkgo_tests.test")
  36. Eventually(session).Should(gexec.Exit(0))
  37. Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite"))
  38. })
  39. It("should be possible to run the test binary in parallel", func() {
  40. session := startGinkgo(pathToTest, "--nodes=4", "--noColor", "./passing_ginkgo_tests.test")
  41. Eventually(session).Should(gexec.Exit(0))
  42. Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite"))
  43. Ω(session).Should(gbytes.Say("Running in parallel across 4 nodes"))
  44. })
  45. })