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