diff options
Diffstat (limited to 'vendor/github.com/onsi/ginkgo/integration')
107 files changed, 4253 insertions, 0 deletions
diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go new file mode 100644 index 000000000..10c1c1bd1 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage.go @@ -0,0 +1,21 @@ +package first_package + +func A() string { + return "A" +} + +func B() string { + return "B" +} + +func C() string { + return "C" +} + +func D() string { + return "D" +} + +func E() string { + return "untested" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_suite_test.go new file mode 100644 index 000000000..4e0976cd5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_suite_test.go @@ -0,0 +1,13 @@ +package first_package_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestCoverageFixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "CombinedFixture First Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_test.go new file mode 100644 index 000000000..dfe3e1127 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_test.go @@ -0,0 +1,31 @@ +package first_package_test + +import ( + . "github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package" + . "github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/external_coverage_fixture" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("CoverageFixture", func() { + It("should test A", func() { + Ω(A()).Should(Equal("A")) + }) + + It("should test B", func() { + Ω(B()).Should(Equal("B")) + }) + + It("should test C", func() { + Ω(C()).Should(Equal("C")) + }) + + It("should test D", func() { + Ω(D()).Should(Equal("D")) + }) + + It("should test external package", func() { + Ω(Tested()).Should(Equal("tested")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/external_coverage_fixture/external_coverage.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/external_coverage_fixture/external_coverage.go new file mode 100644 index 000000000..5280d4ddf --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/external_coverage_fixture/external_coverage.go @@ -0,0 +1,9 @@ +package external_coverage + +func Tested() string { + return "tested" +} + +func Untested() string { + return "untested" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go new file mode 100644 index 000000000..52160989b --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage.go @@ -0,0 +1,21 @@ +package second_package + +func A() string { + return "A" +} + +func B() string { + return "B" +} + +func C() string { + return "C" +} + +func D() string { + return "D" +} + +func E() string { + return "E" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_suite_test.go new file mode 100644 index 000000000..583a0af20 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_suite_test.go @@ -0,0 +1,13 @@ +package second_package_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestCoverageFixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "CombinedFixture Second Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_test.go new file mode 100644 index 000000000..2692bec9b --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_test.go @@ -0,0 +1,29 @@ +package second_package_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package" + . "github.com/onsi/gomega" +) + +var _ = Describe("CoverageFixture", func() { + It("should test A", func() { + Ω(A()).Should(Equal("A")) + }) + + It("should test B", func() { + Ω(B()).Should(Equal("B")) + }) + + It("should test C", func() { + Ω(C()).Should(Equal("C")) + }) + + It("should test D", func() { + Ω(D()).Should(Equal("D")) + }) + + It("should test E", func() { + Ω(E()).Should(Equal("E")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/extra_functions_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/extra_functions_test.go new file mode 100644 index 000000000..ccb3669a5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/extra_functions_test.go @@ -0,0 +1,14 @@ +package tmp + +import ( + "testing" +) + +func TestSomethingLessImportant(t *testing.T) { + strp := "hello!" + somethingImportant(t, &strp) +} + +func somethingImportant(t *testing.T, message *string) { + t.Log("Something important happened in a test: " + *message) +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/nested/nested_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/nested/nested_test.go new file mode 100644 index 000000000..cde42e470 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/nested/nested_test.go @@ -0,0 +1,10 @@ +package nested + +import ( + "testing" +) + +func TestSomethingLessImportant(t *testing.T) { + whatever := &UselessStruct{} + t.Fail(whatever.ImportantField != "SECRET_PASSWORD") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/nested_without_gofiles/subpackage/nested_subpackage_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/nested_without_gofiles/subpackage/nested_subpackage_test.go new file mode 100644 index 000000000..7cdd326c5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/nested_without_gofiles/subpackage/nested_subpackage_test.go @@ -0,0 +1,9 @@ +package subpackage + +import ( + "testing" +) + +func TestNestedSubPackages(t *testing.T) { + t.Fail(true) +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/outside_package_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/outside_package_test.go new file mode 100644 index 000000000..a682eeaff --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/outside_package_test.go @@ -0,0 +1,16 @@ +package tmp_test + +import ( + "testing" +) + +type UselessStruct struct { + ImportantField string +} + +func TestSomethingImportant(t *testing.T) { + whatever := &UselessStruct{} + if whatever.ImportantField != "SECRET_PASSWORD" { + t.Fail() + } +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/xunit_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/xunit_test.go new file mode 100644 index 000000000..049829a7d --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/xunit_test.go @@ -0,0 +1,41 @@ +package tmp + +import ( + "testing" +) + +type UselessStruct struct { + ImportantField string + T *testing.T +} + +var testFunc = func(t *testing.T, arg *string) {} + +func assertEqual(t *testing.T, arg1, arg2 interface{}) { + if arg1 != arg2 { + t.Fail() + } +} + +func TestSomethingImportant(t *testing.T) { + whatever := &UselessStruct{ + T: t, + ImportantField: "SECRET_PASSWORD", + } + something := &UselessStruct{ImportantField: "string value"} + assertEqual(t, whatever.ImportantField, "SECRET_PASSWORD") + assertEqual(t, something.ImportantField, "string value") + + var foo = func(t *testing.T) {} + foo(t) + + strp := "something" + testFunc(t, &strp) + t.Fail() +} + +func Test3Things(t *testing.T) { + if 3 != 3 { + t.Fail() + } +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/extra_functions_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/extra_functions_test.go new file mode 100644 index 000000000..1c2c56cea --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/extra_functions_test.go @@ -0,0 +1,17 @@ +package tmp + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("Testing with Ginkgo", func() { + It("something less important", func() { + + strp := "hello!" + somethingImportant(GinkgoT(), &strp) + }) +}) + +func somethingImportant(t GinkgoTInterface, message *string) { + t.Log("Something important happened in a test: " + *message) +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/fixtures_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/fixtures_suite_test.go new file mode 100644 index 000000000..a9a404b5c --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/fixtures_suite_test.go @@ -0,0 +1,13 @@ +package tmp + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestTmp(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Tmp Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_subpackage_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_subpackage_test.go new file mode 100644 index 000000000..3653eae82 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_subpackage_test.go @@ -0,0 +1,11 @@ +package subpackage + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("Testing with Ginkgo", func() { + It("nested sub packages", func() { + GinkgoT().Fail(true) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_suite_test.go new file mode 100644 index 000000000..721d0f2c3 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_suite_test.go @@ -0,0 +1,13 @@ +package nested_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func TestNested(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Nested Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_test.go new file mode 100644 index 000000000..47364b814 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_test.go @@ -0,0 +1,13 @@ +package nested + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("Testing with Ginkgo", func() { + It("something less important", func() { + + whatever := &UselessStruct{} + GinkgoT().Fail(whatever.ImportantField != "SECRET_PASSWORD") + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/outside_package_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/outside_package_test.go new file mode 100644 index 000000000..1f2e332c4 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/outside_package_test.go @@ -0,0 +1,19 @@ +package tmp_test + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("Testing with Ginkgo", func() { + It("something important", func() { + + whatever := &UselessStruct{} + if whatever.ImportantField != "SECRET_PASSWORD" { + GinkgoT().Fail() + } + }) +}) + +type UselessStruct struct { + ImportantField string +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/suite_test.go new file mode 100644 index 000000000..9ea229135 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/suite_test.go @@ -0,0 +1,13 @@ +package tmp_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func TestConvertFixtures(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "ConvertFixtures Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/xunit_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/xunit_test.go new file mode 100644 index 000000000..dbe3b419d --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/xunit_test.go @@ -0,0 +1,44 @@ +package tmp + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("Testing with Ginkgo", func() { + It("something important", func() { + + whatever := &UselessStruct{ + T: GinkgoT(), + ImportantField: "SECRET_PASSWORD", + } + something := &UselessStruct{ImportantField: "string value"} + assertEqual(GinkgoT(), whatever.ImportantField, "SECRET_PASSWORD") + assertEqual(GinkgoT(), something.ImportantField, "string value") + + var foo = func(t GinkgoTInterface) {} + foo(GinkgoT()) + + strp := "something" + testFunc(GinkgoT(), &strp) + GinkgoT().Fail() + }) + It("3 things", func() { + + if 3 != 3 { + GinkgoT().Fail() + } + }) +}) + +type UselessStruct struct { + ImportantField string + T GinkgoTInterface +} + +var testFunc = func(t GinkgoTInterface, arg *string) {} + +func assertEqual(t GinkgoTInterface, arg1, arg2 interface{}) { + if arg1 != arg2 { + t.Fail() + } +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage.go new file mode 100644 index 000000000..e4d7e43b1 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage.go @@ -0,0 +1,25 @@ +package coverage_fixture + +import ( + _ "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture" +) + +func A() string { + return "A" +} + +func B() string { + return "B" +} + +func C() string { + return "C" +} + +func D() string { + return "D" +} + +func E() string { + return "untested" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage_fixture_suite_test.go new file mode 100644 index 000000000..2831bf7d2 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage_fixture_suite_test.go @@ -0,0 +1,13 @@ +package coverage_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestCoverageFixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "CoverageFixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage_fixture_test.go new file mode 100644 index 000000000..12a72dce8 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage_fixture_test.go @@ -0,0 +1,31 @@ +package coverage_fixture_test + +import ( + . "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture" + . "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("CoverageFixture", func() { + It("should test A", func() { + Ω(A()).Should(Equal("A")) + }) + + It("should test B", func() { + Ω(B()).Should(Equal("B")) + }) + + It("should test C", func() { + Ω(C()).Should(Equal("C")) + }) + + It("should test D", func() { + Ω(D()).Should(Equal("D")) + }) + + It("should test external package", func() { + Ω(Tested()).Should(Equal("tested")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture/external_coverage.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture/external_coverage.go new file mode 100644 index 000000000..5280d4ddf --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture/external_coverage.go @@ -0,0 +1,9 @@ +package external_coverage + +func Tested() string { + return "tested" +} + +func Untested() string { + return "untested" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/debug_parallel_fixture/debug_parallel_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/debug_parallel_fixture/debug_parallel_fixture_suite_test.go new file mode 100644 index 000000000..429aebc5f --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/debug_parallel_fixture/debug_parallel_fixture_suite_test.go @@ -0,0 +1,13 @@ +package debug_parallel_fixture_test + +import ( + "testing" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +func TestDebugParallelFixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "DebugParallelFixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/debug_parallel_fixture/debug_parallel_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/debug_parallel_fixture/debug_parallel_fixture_test.go new file mode 100644 index 000000000..b609a8bca --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/debug_parallel_fixture/debug_parallel_fixture_test.go @@ -0,0 +1,18 @@ +package debug_parallel_fixture_test + +import ( + "fmt" + "time" + + . "github.com/onsi/ginkgo" +) + +var _ = Describe("DebugParallelFixture", func() { + It("emits output to a file", func() { + for i := 0; i < 10; i += 1 { + fmt.Printf("StdOut %d\n", i) + GinkgoWriter.Write([]byte(fmt.Sprintf("GinkgoWriter %d\n", i))) + } + time.Sleep(time.Second) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/does_not_compile/does_not_compile_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/does_not_compile/does_not_compile_suite_test.go new file mode 100644 index 000000000..01e792696 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/does_not_compile/does_not_compile_suite_test.go @@ -0,0 +1,13 @@ +package does_not_compile_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestDoes_not_compile(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Does_not_compile Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/does_not_compile/does_not_compile_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/does_not_compile/does_not_compile_test.go new file mode 100644 index 000000000..e4f22b3cc --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/does_not_compile/does_not_compile_test.go @@ -0,0 +1,11 @@ +package does_not_compile_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/does_not_compile" + . "github.com/onsi/gomega" +) + +var _ = Describe("DoesNotCompile", func() { + +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/eventually_failing/eventually_failing_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/eventually_failing/eventually_failing_suite_test.go new file mode 100644 index 000000000..97fa2e775 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/eventually_failing/eventually_failing_suite_test.go @@ -0,0 +1,13 @@ +package eventually_failing_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestEventuallyFailing(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "EventuallyFailing Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/eventually_failing/eventually_failing_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/eventually_failing/eventually_failing_test.go new file mode 100644 index 000000000..6c83b4258 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/eventually_failing/eventually_failing_test.go @@ -0,0 +1,29 @@ +package eventually_failing_test + +import ( + "fmt" + "io/ioutil" + "strings" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("EventuallyFailing", func() { + It("should fail on the third try", func() { + time.Sleep(time.Second) + files, err := ioutil.ReadDir(".") + Ω(err).ShouldNot(HaveOccurred()) + + numRuns := 1 + for _, file := range files { + if strings.HasPrefix(file.Name(), "counter") { + numRuns++ + } + } + + Ω(numRuns).Should(BeNumerically("<", 3)) + ioutil.WriteFile(fmt.Sprintf("./counter-%d", numRuns), []byte("foo"), 0777) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/exiting_synchronized_setup_tests/exiting_synchronized_setup_tests_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/exiting_synchronized_setup_tests/exiting_synchronized_setup_tests_suite_test.go new file mode 100644 index 000000000..045ca7c66 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/exiting_synchronized_setup_tests/exiting_synchronized_setup_tests_suite_test.go @@ -0,0 +1,35 @@ +package synchronized_setup_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "fmt" + "os" + "testing" +) + +func TestSynchronized_setup_tests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Synchronized_setup_tests Suite") +} + +var beforeData string + +var _ = SynchronizedBeforeSuite(func() []byte { + fmt.Printf("BEFORE_A_%d\n", GinkgoParallelNode()) + os.Exit(1) + return []byte("WHAT EVZ") +}, func(data []byte) { + println("NEVER SEE THIS") +}) + +var _ = Describe("Synchronized Setup", func() { + It("should do nothing", func() { + Ω(true).Should(BeTrue()) + }) + + It("should do nothing", func() { + Ω(true).Should(BeTrue()) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_suite_test.go new file mode 100644 index 000000000..6e822643a --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_suite_test.go @@ -0,0 +1,13 @@ +package fail_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFail_fixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Fail_fixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_test.go new file mode 100644 index 000000000..ea6f71ca9 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_test.go @@ -0,0 +1,103 @@ +package fail_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = It("handles top level failures", func() { + Ω("a top level failure on line 9").Should(Equal("nope")) + println("NEVER SEE THIS") +}) + +var _ = It("handles async top level failures", func(done Done) { + Fail("an async top level failure on line 14") + println("NEVER SEE THIS") +}, 0.1) + +var _ = It("FAIL in a goroutine", func(done Done) { + go func() { + defer GinkgoRecover() + Fail("a top level goroutine failure on line 21") + println("NEVER SEE THIS") + }() +}, 0.1) + +var _ = Describe("Excercising different failure modes", func() { + It("synchronous failures", func() { + Ω("a sync failure").Should(Equal("nope")) + println("NEVER SEE THIS") + }) + + It("synchronous panics", func() { + panic("a sync panic") + println("NEVER SEE THIS") + }) + + It("synchronous failures with FAIL", func() { + Fail("a sync FAIL failure") + println("NEVER SEE THIS") + }) + + It("async timeout", func(done Done) { + Ω(true).Should(BeTrue()) + }, 0.1) + + It("async failure", func(done Done) { + Ω("an async failure").Should(Equal("nope")) + println("NEVER SEE THIS") + }, 0.1) + + It("async panic", func(done Done) { + panic("an async panic") + println("NEVER SEE THIS") + }, 0.1) + + It("async failure with FAIL", func(done Done) { + Fail("an async FAIL failure") + println("NEVER SEE THIS") + }, 0.1) + + It("FAIL in a goroutine", func(done Done) { + go func() { + defer GinkgoRecover() + Fail("a goroutine FAIL failure") + println("NEVER SEE THIS") + }() + }, 0.1) + + It("Gomega in a goroutine", func(done Done) { + go func() { + defer GinkgoRecover() + Ω("a goroutine failure").Should(Equal("nope")) + println("NEVER SEE THIS") + }() + }, 0.1) + + It("Panic in a goroutine", func(done Done) { + go func() { + defer GinkgoRecover() + panic("a goroutine panic") + println("NEVER SEE THIS") + }() + }, 0.1) + + Measure("a FAIL measure", func(Benchmarker) { + Fail("a measure FAIL failure") + println("NEVER SEE THIS") + }, 1) + + Measure("a gomega failed measure", func(Benchmarker) { + Ω("a measure failure").Should(Equal("nope")) + println("NEVER SEE THIS") + }, 1) + + Measure("a panicking measure", func(Benchmarker) { + panic("a measure panic") + println("NEVER SEE THIS") + }, 1) +}) + +var _ = Specify("a top level specify", func() { + Fail("fail the test") +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_after_suite/failing_after_suite_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_after_suite/failing_after_suite_suite_test.go new file mode 100644 index 000000000..0e410aaea --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_after_suite/failing_after_suite_suite_test.go @@ -0,0 +1,22 @@ +package failing_before_suite_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFailingAfterSuite(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "FailingAfterSuite Suite") +} + +var _ = BeforeSuite(func() { + println("BEFORE SUITE") +}) + +var _ = AfterSuite(func() { + println("AFTER SUITE") + panic("BAM!") +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_after_suite/failing_after_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_after_suite/failing_after_suite_test.go new file mode 100644 index 000000000..3902ec6c5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_after_suite/failing_after_suite_test.go @@ -0,0 +1,15 @@ +package failing_before_suite_test + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("FailingBeforeSuite", func() { + It("should run", func() { + println("A TEST") + }) + + It("should run", func() { + println("A TEST") + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_before_suite/failing_before_suite_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_before_suite/failing_before_suite_suite_test.go new file mode 100644 index 000000000..109ea3608 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_before_suite/failing_before_suite_suite_test.go @@ -0,0 +1,22 @@ +package failing_before_suite_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFailing_before_suite(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Failing_before_suite Suite") +} + +var _ = BeforeSuite(func() { + println("BEFORE SUITE") + panic("BAM!") +}) + +var _ = AfterSuite(func() { + println("AFTER SUITE") +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_before_suite/failing_before_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_before_suite/failing_before_suite_test.go new file mode 100644 index 000000000..e8697c64a --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_before_suite/failing_before_suite_test.go @@ -0,0 +1,15 @@ +package failing_before_suite_test + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("FailingBeforeSuite", func() { + It("should never run", func() { + println("NEVER SEE THIS") + }) + + It("should never run", func() { + println("NEVER SEE THIS") + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests.go new file mode 100644 index 000000000..e32cd619e --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests.go @@ -0,0 +1,5 @@ +package failing_ginkgo_tests + +func AlwaysFalse() bool { + return false +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests_suite_test.go new file mode 100644 index 000000000..49939bda5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests_suite_test.go @@ -0,0 +1,13 @@ +package failing_ginkgo_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFailing_ginkgo_tests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Failing_ginkgo_tests Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests_test.go new file mode 100644 index 000000000..d9c01e32c --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests/failing_ginkgo_tests_test.go @@ -0,0 +1,17 @@ +package failing_ginkgo_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests" + . "github.com/onsi/gomega" +) + +var _ = Describe("FailingGinkgoTests", func() { + It("should fail", func() { + Ω(AlwaysFalse()).Should(BeTrue()) + }) + + It("should pass", func() { + Ω(AlwaysFalse()).Should(BeFalse()) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags.go new file mode 100644 index 000000000..a440abdaa --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags.go @@ -0,0 +1,9 @@ +package flags + +func Tested() string { + return "tested" +} + +func Untested() string { + return "untested" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_suite_test.go new file mode 100644 index 000000000..0b3071f62 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_suite_test.go @@ -0,0 +1,13 @@ +package flags_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFlags(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Flags Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_test.go new file mode 100644 index 000000000..27dadf19c --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_test.go @@ -0,0 +1,97 @@ +package flags_test + +import ( + "flag" + "fmt" + remapped "math" + _ "math/cmplx" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/flags_tests" + . "github.com/onsi/gomega" +) + +var customFlag string + +func init() { + flag.StringVar(&customFlag, "customFlag", "default", "custom flag!") +} + +var _ = Describe("Testing various flags", func() { + FDescribe("the focused set", func() { + Measure("a measurement", func(b Benchmarker) { + b.RecordValue("a value", 3) + }, 3) + + It("should honor -cover", func() { + Ω(Tested()).Should(Equal("tested")) + }) + + It("should allow gcflags", func() { + fmt.Printf("NaN returns %T\n", remapped.NaN()) + }) + + PIt("should honor -failOnPending and -noisyPendings") + + Describe("smores", func() { + It("should honor -skip: marshmallow", func() { + println("marshmallow") + }) + + It("should honor -focus: chocolate", func() { + println("chocolate") + }) + }) + + It("should detect races", func(done Done) { + var a string + go func() { + a = "now you don't" + close(done) + }() + a = "now you see me" + println(a) + }) + + It("should randomize A", func() { + println("RANDOM_A") + }) + + It("should randomize B", func() { + println("RANDOM_B") + }) + + It("should randomize C", func() { + println("RANDOM_C") + }) + + It("should honor -slowSpecThreshold", func() { + time.Sleep(100 * time.Millisecond) + }) + + It("should pass in additional arguments after '--' directly to the test process", func() { + fmt.Printf("CUSTOM_FLAG: %s", customFlag) + }) + }) + + Describe("more smores", func() { + It("should not run these unless -focus is set", func() { + println("smores") + }) + }) + + Describe("a failing test", func() { + It("should fail", func() { + Ω(true).Should(Equal(false)) + }) + }) + + Describe("a flaky test", func() { + runs := 0 + It("should only pass the second time it's run", func() { + runs++ + Ω(runs).Should(BeNumerically("==", 2)) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/README.md b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/README.md new file mode 100644 index 000000000..2b501a25d --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/README.md @@ -0,0 +1 @@ +This file should remain the same, regardless the fact that contains FIt, FDescribe, or FWhen. diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/focused_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/focused_fixture_suite_test.go new file mode 100644 index 000000000..92d0c6e48 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/focused_fixture_suite_test.go @@ -0,0 +1,13 @@ +package focused_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFocused_fixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Focused_fixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/focused_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/focused_fixture_test.go new file mode 100644 index 000000000..ea500eaf0 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture/focused_fixture_test.go @@ -0,0 +1,73 @@ +package focused_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/extensions/table" +) + +var _ = Describe("FocusedFixture", func() { + FDescribe("focused", func() { + It("focused", func() { + + }) + }) + + FContext("focused", func() { + It("focused", func() { + + }) + }) + + FWhen("focused", func() { + It("focused", func() { + + }) + }) + + FIt("focused", func() { + + }) + + FSpecify("focused", func() { + + }) + + FMeasure("focused", func(b Benchmarker) { + + }, 2) + + FDescribeTable("focused", + func() {}, + Entry("focused"), + ) + + DescribeTable("focused", + func() {}, + FEntry("focused"), + ) + + Describe("not focused", func() { + It("not focused", func() { + + }) + }) + + Context("not focused", func() { + It("not focused", func() { + + }) + }) + + It("not focused", func() { + + }) + + Measure("not focused", func(b Benchmarker) { + + }, 2) + + DescribeTable("not focused", + func() {}, + Entry("not focused"), + ) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture_with_vendor/focused_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture_with_vendor/focused_fixture_suite_test.go new file mode 100644 index 000000000..92d0c6e48 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture_with_vendor/focused_fixture_suite_test.go @@ -0,0 +1,13 @@ +package focused_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFocused_fixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Focused_fixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture_with_vendor/focused_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture_with_vendor/focused_fixture_test.go new file mode 100644 index 000000000..ea500eaf0 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/focused_fixture_with_vendor/focused_fixture_test.go @@ -0,0 +1,73 @@ +package focused_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/extensions/table" +) + +var _ = Describe("FocusedFixture", func() { + FDescribe("focused", func() { + It("focused", func() { + + }) + }) + + FContext("focused", func() { + It("focused", func() { + + }) + }) + + FWhen("focused", func() { + It("focused", func() { + + }) + }) + + FIt("focused", func() { + + }) + + FSpecify("focused", func() { + + }) + + FMeasure("focused", func(b Benchmarker) { + + }, 2) + + FDescribeTable("focused", + func() {}, + Entry("focused"), + ) + + DescribeTable("focused", + func() {}, + FEntry("focused"), + ) + + Describe("not focused", func() { + It("not focused", func() { + + }) + }) + + Context("not focused", func() { + It("not focused", func() { + + }) + }) + + It("not focused", func() { + + }) + + Measure("not focused", func(b Benchmarker) { + + }, 2) + + DescribeTable("not focused", + func() {}, + Entry("not focused"), + ) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_suite_test.go new file mode 100644 index 000000000..e8dd54b52 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_suite_test.go @@ -0,0 +1,13 @@ +package hanging_suite_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestHangingSuite(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "HangingSuite Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_test.go new file mode 100644 index 000000000..6a5a070e1 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_test.go @@ -0,0 +1,30 @@ +package hanging_suite_test + +import ( + "fmt" + "time" + + . "github.com/onsi/ginkgo" +) + +var _ = AfterSuite(func() { + fmt.Println("Heading Out After Suite") +}) + +var _ = Describe("HangingSuite", func() { + BeforeEach(func() { + fmt.Fprintln(GinkgoWriter, "Just beginning") + }) + + Context("inner context", func() { + BeforeEach(func() { + fmt.Fprintln(GinkgoWriter, "Almost there...") + }) + + It("should hang out for a while", func() { + fmt.Fprintln(GinkgoWriter, "Hanging Out") + fmt.Println("Sleeping...") + time.Sleep(time.Hour) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests.go new file mode 100644 index 000000000..ca12c0d93 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests.go @@ -0,0 +1,5 @@ +package more_ginkgo_tests + +func AlwaysTrue() bool { + return true +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests_suite_test.go new file mode 100644 index 000000000..1e15c8857 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests_suite_test.go @@ -0,0 +1,13 @@ +package more_ginkgo_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestMore_ginkgo_tests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "More_ginkgo_tests Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests_test.go new file mode 100644 index 000000000..0549f62fb --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests/more_ginkgo_tests_test.go @@ -0,0 +1,17 @@ +package more_ginkgo_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests" + . "github.com/onsi/gomega" +) + +var _ = Describe("MoreGinkgoTests", func() { + It("should pass", func() { + Ω(AlwaysTrue()).Should(BeTrue()) + }) + + It("should always pass", func() { + Ω(AlwaysTrue()).Should(BeTrue()) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_test_fn/no_test_fn.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_test_fn/no_test_fn.go new file mode 100644 index 000000000..bdf1b54b5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_test_fn/no_test_fn.go @@ -0,0 +1,5 @@ +package no_test_fn + +func StringIdentity(a string) string { + return a +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_test_fn/no_test_fn_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_test_fn/no_test_fn_test.go new file mode 100644 index 000000000..6c38b1e43 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_test_fn/no_test_fn_test.go @@ -0,0 +1,13 @@ +package no_test_fn_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/no_test_fn" + . "github.com/onsi/gomega" +) + +var _ = Describe("NoTestFn", func() { + It("should proxy strings", func() { + Ω(StringIdentity("foo")).Should(Equal("foo")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_tests/no_tests.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_tests/no_tests.go new file mode 100644 index 000000000..da29a2cad --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/no_tests/no_tests.go @@ -0,0 +1,4 @@ +package main + +func main() { +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests.go new file mode 100644 index 000000000..b710dd129 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests.go @@ -0,0 +1,9 @@ +package passing_ginkgo_tests + +func StringIdentity(a string) string { + return a +} + +func IntegerIdentity(a int) int { + return a +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests_suite_test.go new file mode 100644 index 000000000..31a3f7d0c --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests_suite_test.go @@ -0,0 +1,13 @@ +package passing_ginkgo_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestPassing_ginkgo_tests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Passing_ginkgo_tests Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests_test.go new file mode 100644 index 000000000..a5822fdd7 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests/passing_ginkgo_tests_test.go @@ -0,0 +1,30 @@ +package passing_ginkgo_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests" + . "github.com/onsi/gomega" +) + +var _ = Describe("PassingGinkgoTests", func() { + It("should proxy strings", func() { + Ω(StringIdentity("foo")).Should(Equal("foo")) + }) + + It("should proxy integers", func() { + Ω(IntegerIdentity(3)).Should(Equal(3)) + }) + + It("should do it again", func() { + Ω(StringIdentity("foo")).Should(Equal("foo")) + Ω(IntegerIdentity(3)).Should(Equal(3)) + }) + + It("should be able to run Bys", func() { + By("emitting one By") + Ω(3).Should(Equal(3)) + + By("emitting another By") + Ω(4).Should(Equal(4)) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_suite_setup/passing_suite_setup_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_suite_setup/passing_suite_setup_suite_test.go new file mode 100644 index 000000000..86c9aa2ab --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_suite_setup/passing_suite_setup_suite_test.go @@ -0,0 +1,26 @@ +package passing_before_suite_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestPassingSuiteSetup(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "PassingSuiteSetup Suite") +} + +var a string +var b string + +var _ = BeforeSuite(func() { + a = "ran before suite" + println("BEFORE SUITE") +}) + +var _ = AfterSuite(func() { + b = "ran after suite" + println("AFTER SUITE") +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_suite_setup/passing_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_suite_setup/passing_suite_test.go new file mode 100644 index 000000000..f139e1d22 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/passing_suite_setup/passing_suite_test.go @@ -0,0 +1,28 @@ +package passing_before_suite_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("PassingSuiteSetup", func() { + It("should pass", func() { + Ω(a).Should(Equal("ran before suite")) + Ω(b).Should(BeEmpty()) + }) + + It("should pass", func() { + Ω(a).Should(Equal("ran before suite")) + Ω(b).Should(BeEmpty()) + }) + + It("should pass", func() { + Ω(a).Should(Equal("ran before suite")) + Ω(b).Should(BeEmpty()) + }) + + It("should pass", func() { + Ω(a).Should(Equal("ran before suite")) + Ω(b).Should(BeEmpty()) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/progress_fixture/progress_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/progress_fixture/progress_fixture_suite_test.go new file mode 100644 index 000000000..74262bbc1 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/progress_fixture/progress_fixture_suite_test.go @@ -0,0 +1,13 @@ +package progress_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestProgressFixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "ProgressFixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/progress_fixture/progress_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/progress_fixture/progress_fixture_test.go new file mode 100644 index 000000000..b7f26c25b --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/progress_fixture/progress_fixture_test.go @@ -0,0 +1,49 @@ +package progress_fixture_test + +import ( + "fmt" + + . "github.com/onsi/ginkgo" +) + +var _ = Describe("ProgressFixture", func() { + BeforeEach(func() { + fmt.Fprintln(GinkgoWriter, ">outer before<") + }) + + JustBeforeEach(func() { + fmt.Fprintln(GinkgoWriter, ">outer just before<") + }) + + AfterEach(func() { + fmt.Fprintln(GinkgoWriter, ">outer after<") + }) + + Context("Inner Context", func() { + BeforeEach(func() { + fmt.Fprintln(GinkgoWriter, ">inner before<") + }) + + JustBeforeEach(func() { + fmt.Fprintln(GinkgoWriter, ">inner just before<") + }) + + AfterEach(func() { + fmt.Fprintln(GinkgoWriter, ">inner after<") + }) + + When("Inner When", func() { + BeforeEach(func() { + fmt.Fprintln(GinkgoWriter, ">inner before<") + }) + + It("should emit progress as it goes", func() { + fmt.Fprintln(GinkgoWriter, ">it<") + }) + }) + }) + + Specify("should emit progress as it goes", func() { + fmt.Fprintln(GinkgoWriter, ">specify<") + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_suite_test.go new file mode 100644 index 000000000..b2028cf55 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_suite_test.go @@ -0,0 +1,13 @@ +package fail_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestFail_fixture(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Skip_fixture Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_test.go new file mode 100644 index 000000000..e406aeb46 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_test.go @@ -0,0 +1,71 @@ +package fail_fixture_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = It("handles top level skips", func() { + Skip("a top level skip on line 9") + println("NEVER SEE THIS") +}) + +var _ = It("handles async top level skips", func(done Done) { + Skip("an async top level skip on line 14") + println("NEVER SEE THIS") +}, 0.1) + +var _ = It("SKIP in a goroutine", func(done Done) { + go func() { + defer GinkgoRecover() + Skip("a top level goroutine skip on line 21") + println("NEVER SEE THIS") + }() +}, 0.1) + +var _ = Describe("Excercising different skip modes", func() { + It("synchronous skip", func() { + Skip("a sync SKIP") + println("NEVER SEE THIS") + }) + + It("async skip", func(done Done) { + Skip("an async SKIP") + println("NEVER SEE THIS") + }, 0.1) + + It("SKIP in a goroutine", func(done Done) { + go func() { + defer GinkgoRecover() + Skip("a goroutine SKIP") + println("NEVER SEE THIS") + }() + }, 0.1) + + Measure("a SKIP measure", func(Benchmarker) { + Skip("a measure SKIP") + println("NEVER SEE THIS") + }, 1) +}) + +var _ = Describe("SKIP in a BeforeEach", func() { + BeforeEach(func() { + Skip("a BeforeEach SKIP") + println("NEVER SEE THIS") + }) + + It("a SKIP BeforeEach", func() { + println("NEVER SEE THIS") + }) +}) + +var _ = Describe("SKIP in an AfterEach", func() { + AfterEach(func() { + Skip("an AfterEach SKIP") + println("NEVER SEE THIS") + }) + + It("a SKIP AfterEach", func() { + Expect(true).To(BeTrue()) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command.go new file mode 100644 index 000000000..1d6704881 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command.go @@ -0,0 +1,9 @@ +package suite_command + +func Tested() string { + return "tested" +} + +func Untested() string { + return "untested" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command_suite_test.go new file mode 100644 index 000000000..7f76d8b8f --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command_suite_test.go @@ -0,0 +1,13 @@ +package suite_command_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestSuiteCommand(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Suite Command Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command_test.go new file mode 100644 index 000000000..e083d27a2 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/suite_command_tests/suite_command_test.go @@ -0,0 +1,18 @@ +package suite_command_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("Testing suite command", func() { + It("it should succeed", func() { + Ω(true).Should(Equal(true)) + }) + + PIt("a failing test", func() { + It("should fail", func() { + Ω(true).Should(Equal(false)) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/synchronized_setup_tests/synchronized_setup_tests_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/synchronized_setup_tests/synchronized_setup_tests_suite_test.go new file mode 100644 index 000000000..b734854ee --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/synchronized_setup_tests/synchronized_setup_tests_suite_test.go @@ -0,0 +1,43 @@ +package synchronized_setup_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "fmt" + "testing" + "time" +) + +func TestSynchronized_setup_tests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "Synchronized_setup_tests Suite") +} + +var beforeData string + +var _ = SynchronizedBeforeSuite(func() []byte { + fmt.Printf("BEFORE_A_%d\n", GinkgoParallelNode()) + time.Sleep(100 * time.Millisecond) + return []byte("DATA") +}, func(data []byte) { + fmt.Printf("BEFORE_B_%d: %s\n", GinkgoParallelNode(), string(data)) + beforeData += string(data) + "OTHER" +}) + +var _ = SynchronizedAfterSuite(func() { + fmt.Printf("\nAFTER_A_%d\n", GinkgoParallelNode()) + time.Sleep(100 * time.Millisecond) +}, func() { + fmt.Printf("AFTER_B_%d\n", GinkgoParallelNode()) +}) + +var _ = Describe("Synchronized Setup", func() { + It("should run the before suite once", func() { + Ω(beforeData).Should(Equal("DATAOTHER")) + }) + + It("should run the before suite once", func() { + Ω(beforeData).Should(Equal("DATAOTHER")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/ignored_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/ignored_test.go new file mode 100644 index 000000000..517623536 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/ignored_test.go @@ -0,0 +1,17 @@ +// +build complex_tests + +package tags_tests_test + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("Ignored", func() { + It("should not have these tests", func() { + + }) + + It("should not have these tests", func() { + + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_suite_test.go new file mode 100644 index 000000000..dcb11bb1b --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_suite_test.go @@ -0,0 +1,13 @@ +package tags_tests_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestTagsTests(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "TagsTests Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_test.go new file mode 100644 index 000000000..b91a8923a --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_test.go @@ -0,0 +1,11 @@ +package tags_tests_test + +import ( + . "github.com/onsi/ginkgo" +) + +var _ = Describe("TagsTests", func() { + It("should have a test", func() { + + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/test_description/test_description_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/test_description/test_description_suite_test.go new file mode 100644 index 000000000..8976370d3 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/test_description/test_description_suite_test.go @@ -0,0 +1,13 @@ +package test_description_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestTestDescription(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "TestDescription Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/test_description/test_description_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/test_description/test_description_test.go new file mode 100644 index 000000000..53c2779ea --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/test_description/test_description_test.go @@ -0,0 +1,23 @@ +package test_description_test + +import ( + "fmt" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("TestDescription", func() { + It("should pass", func() { + Ω(true).Should(BeTrue()) + }) + + It("should fail", func() { + Ω(true).Should(BeFalse()) + }) + + AfterEach(func() { + description := CurrentGinkgoTestDescription() + fmt.Printf("%s:%t\n", description.FullTestText, description.Failed) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A.go new file mode 100644 index 000000000..de2c6bbb7 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A.go @@ -0,0 +1,7 @@ +package A + +import "github.com/onsi/B" + +func DoIt() string { + return B.DoIt() +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_suite_test.go new file mode 100644 index 000000000..1b6cff4c7 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_suite_test.go @@ -0,0 +1,13 @@ +package A_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestA(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "A Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_test.go new file mode 100644 index 000000000..003530aae --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_test.go @@ -0,0 +1,14 @@ +package A_test + +import ( + . "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("A", func() { + It("should do it", func() { + Ω(DoIt()).Should(Equal("done!")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B.go new file mode 100644 index 000000000..990bab365 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B.go @@ -0,0 +1,7 @@ +package B + +import "github.com/onsi/C" + +func DoIt() string { + return C.DoIt() +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_suite_test.go new file mode 100644 index 000000000..e54fce668 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_suite_test.go @@ -0,0 +1,13 @@ +package B_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestB(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "B Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_test.go new file mode 100644 index 000000000..b147913c0 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_test.go @@ -0,0 +1,14 @@ +package B_test + +import ( + . "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("B", func() { + It("should do it", func() { + Ω(DoIt()).Should(Equal("done!")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.go new file mode 100644 index 000000000..205b68886 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.go @@ -0,0 +1,5 @@ +package C + +func DoIt() string { + return "done!" +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.json b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.json new file mode 100644 index 000000000..421d025e0 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.json @@ -0,0 +1,3 @@ +{ + "fixture": "data" +}
\ No newline at end of file diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_suite_test.go new file mode 100644 index 000000000..57a7a96ba --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_suite_test.go @@ -0,0 +1,13 @@ +package C_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestC(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "C Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_test.go new file mode 100644 index 000000000..7703fefa3 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_test.go @@ -0,0 +1,14 @@ +package C_test + +import ( + . "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("C", func() { + It("should do it", func() { + Ω(DoIt()).Should(Equal("done!")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D.go new file mode 100644 index 000000000..4371b852f --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D.go @@ -0,0 +1,7 @@ +package D + +import "github.com/onsi/C" + +func DoIt() string { + return C.DoIt() +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_suite_test.go new file mode 100644 index 000000000..0ebefe6b7 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_suite_test.go @@ -0,0 +1,13 @@ +package D_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + + "testing" +) + +func TestD(t *testing.T) { + RegisterFailHandler(Fail) + RunSpecs(t, "D Suite") +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_test.go new file mode 100644 index 000000000..097945bf9 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_test.go @@ -0,0 +1,14 @@ +package D_test + +import ( + . "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("D", func() { + It("should do it", func() { + Ω(DoIt()).Should(Equal("done!")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests.go new file mode 100644 index 000000000..cb8fc8bc2 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests.go @@ -0,0 +1,5 @@ +package xunit_tests + +func AlwaysTrue() bool { + return true +} diff --git a/vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests_test.go b/vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests_test.go new file mode 100644 index 000000000..a6ebbe147 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests_test.go @@ -0,0 +1,11 @@ +package xunit_tests + +import ( + "testing" +) + +func TestAlwaysTrue(t *testing.T) { + if AlwaysTrue() != true { + t.Errorf("Expected true, got false") + } +} diff --git a/vendor/github.com/onsi/ginkgo/integration/convert_test.go b/vendor/github.com/onsi/ginkgo/integration/convert_test.go new file mode 100644 index 000000000..f4fd678c5 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/convert_test.go @@ -0,0 +1,121 @@ +package integration_test + +import ( + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "strings" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" +) + +var _ = Describe("ginkgo convert", func() { + var tmpDir string + + readConvertedFileNamed := func(pathComponents ...string) string { + pathToFile := filepath.Join(tmpDir, "convert_fixtures", filepath.Join(pathComponents...)) + bytes, err := ioutil.ReadFile(pathToFile) + ExpectWithOffset(1, err).NotTo(HaveOccurred()) + + return string(bytes) + } + + readGoldMasterNamed := func(filename string) string { + bytes, err := ioutil.ReadFile(filepath.Join("_fixtures", "convert_goldmasters", filename)) + Ω(err).ShouldNot(HaveOccurred()) + + return string(bytes) + } + + BeforeEach(func() { + var err error + + tmpDir, err = ioutil.TempDir("", "ginkgo-convert") + Ω(err).ShouldNot(HaveOccurred()) + + err = exec.Command("cp", "-r", filepath.Join("_fixtures", "convert_fixtures"), tmpDir).Run() + Ω(err).ShouldNot(HaveOccurred()) + }) + + JustBeforeEach(func() { + cwd, err := os.Getwd() + Ω(err).ShouldNot(HaveOccurred()) + + relPath, err := filepath.Rel(cwd, filepath.Join(tmpDir, "convert_fixtures")) + Ω(err).ShouldNot(HaveOccurred()) + + cmd := exec.Command(pathToGinkgo, "convert", relPath) + cmd.Env = os.Environ() + for i, env := range cmd.Env { + if strings.HasPrefix(env, "PATH") { + cmd.Env[i] = cmd.Env[i] + ":" + filepath.Dir(pathToGinkgo) + break + } + } + err = cmd.Run() + Ω(err).ShouldNot(HaveOccurred()) + }) + + AfterEach(func() { + err := os.RemoveAll(tmpDir) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("rewrites xunit tests as ginkgo tests", func() { + convertedFile := readConvertedFileNamed("xunit_test.go") + goldMaster := readGoldMasterNamed("xunit_test.go") + Ω(convertedFile).Should(Equal(goldMaster)) + }) + + It("rewrites all usages of *testing.T as mr.T()", func() { + convertedFile := readConvertedFileNamed("extra_functions_test.go") + goldMaster := readGoldMasterNamed("extra_functions_test.go") + Ω(convertedFile).Should(Equal(goldMaster)) + }) + + It("rewrites tests in the package dir that belong to other packages", func() { + convertedFile := readConvertedFileNamed("outside_package_test.go") + goldMaster := readGoldMasterNamed("outside_package_test.go") + Ω(convertedFile).Should(Equal(goldMaster)) + }) + + It("rewrites tests in nested packages", func() { + convertedFile := readConvertedFileNamed("nested", "nested_test.go") + goldMaster := readGoldMasterNamed("nested_test.go") + Ω(convertedFile).Should(Equal(goldMaster)) + }) + + Context("ginkgo test suite files", func() { + It("creates a ginkgo test suite file for the package you specified", func() { + testsuite := readConvertedFileNamed("convert_fixtures_suite_test.go") + goldMaster := readGoldMasterNamed("suite_test.go") + Ω(testsuite).Should(Equal(goldMaster)) + }) + + It("converts go tests in deeply nested packages (some may not contain go files)", func() { + testsuite := readConvertedFileNamed("nested_without_gofiles", "subpackage", "nested_subpackage_test.go") + goldMaster := readGoldMasterNamed("nested_subpackage_test.go") + Ω(testsuite).Should(Equal(goldMaster)) + }) + + It("creates ginkgo test suites for all nested packages", func() { + testsuite := readConvertedFileNamed("nested", "nested_suite_test.go") + goldMaster := readGoldMasterNamed("nested_suite_test.go") + Ω(testsuite).Should(Equal(goldMaster)) + }) + }) + + Context("with an existing test suite file", func() { + BeforeEach(func() { + goldMaster := readGoldMasterNamed("fixtures_suite_test.go") + err := ioutil.WriteFile(filepath.Join(tmpDir, "convert_fixtures", "tmp_suite_test.go"), []byte(goldMaster), 0600) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("gracefully handles existing test suite files", func() { + //nothing should have gone wrong! + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/coverage_test.go b/vendor/github.com/onsi/ginkgo/integration/coverage_test.go new file mode 100644 index 000000000..a1d24bfed --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/coverage_test.go @@ -0,0 +1,147 @@ +package integration_test + +import ( + "os/exec" + + "fmt" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Coverage Specs", func() { + Context("when it runs coverage analysis in series and in parallel", func() { + AfterEach(func() { + removeSuccessfully("./_fixtures/coverage_fixture/coverage_fixture.coverprofile") + }) + It("works", func() { + session := startGinkgo("./_fixtures/coverage_fixture", "-cover") + Eventually(session).Should(gexec.Exit(0)) + + Ω(session.Out).Should(gbytes.Say(("coverage: 80.0% of statements"))) + + coverFile := "./_fixtures/coverage_fixture/coverage_fixture.coverprofile" + serialCoverProfileOutput, err := exec.Command("go", "tool", "cover", fmt.Sprintf("-func=%s", coverFile)).CombinedOutput() + Ω(err).ShouldNot(HaveOccurred()) + + removeSuccessfully(coverFile) + + Eventually(startGinkgo("./_fixtures/coverage_fixture", "-cover", "-nodes=4")).Should(gexec.Exit(0)) + + parallelCoverProfileOutput, err := exec.Command("go", "tool", "cover", fmt.Sprintf("-func=%s", coverFile)).CombinedOutput() + Ω(err).ShouldNot(HaveOccurred()) + + Ω(parallelCoverProfileOutput).Should(Equal(serialCoverProfileOutput)) + + By("handling external packages", func() { + session = startGinkgo("./_fixtures/coverage_fixture", "-coverpkg=github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture,github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture") + Eventually(session).Should(gexec.Exit(0)) + + Ω(session.Out).Should(gbytes.Say("coverage: 71.4% of statements in github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture, github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture")) + + serialCoverProfileOutput, err = exec.Command("go", "tool", "cover", fmt.Sprintf("-func=%s", coverFile)).CombinedOutput() + Ω(err).ShouldNot(HaveOccurred()) + + removeSuccessfully("./_fixtures/coverage_fixture/coverage_fixture.coverprofile") + + Eventually(startGinkgo("./_fixtures/coverage_fixture", "-coverpkg=github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture,github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture", "-nodes=4")).Should(gexec.Exit(0)) + + parallelCoverProfileOutput, err = exec.Command("go", "tool", "cover", fmt.Sprintf("-func=%s", coverFile)).CombinedOutput() + Ω(err).ShouldNot(HaveOccurred()) + + Ω(parallelCoverProfileOutput).Should(Equal(serialCoverProfileOutput)) + }) + }) + }) + + Context("when a custom profile name is specified", func() { + AfterEach(func() { + removeSuccessfully("./_fixtures/coverage_fixture/coverage.txt") + }) + + It("generates cover profiles with the specified name", func() { + session := startGinkgo("./_fixtures/coverage_fixture", "-cover", "-coverprofile=coverage.txt") + Eventually(session).Should(gexec.Exit(0)) + + Ω("./_fixtures/coverage_fixture/coverage.txt").Should(BeARegularFile()) + }) + }) + + Context("when run in recursive mode", func() { + AfterEach(func() { + removeSuccessfully("./_fixtures/combined_coverage_fixture/coverage-recursive.txt") + removeSuccessfully("./_fixtures/combined_coverage_fixture/first_package/coverage-recursive.txt") + removeSuccessfully("./_fixtures/combined_coverage_fixture/second_package/coverage-recursive.txt") + }) + + It("generates a coverage file per package", func() { + session := startGinkgo("./_fixtures/combined_coverage_fixture", "-r", "-cover", "-coverprofile=coverage-recursive.txt") + Eventually(session).Should(gexec.Exit(0)) + + Ω("./_fixtures/combined_coverage_fixture/first_package/coverage-recursive.txt").Should(BeARegularFile()) + Ω("./_fixtures/combined_coverage_fixture/second_package/coverage-recursive.txt").Should(BeARegularFile()) + }) + }) + + Context("when run in parallel mode", func() { + AfterEach(func() { + removeSuccessfully("./_fixtures/coverage_fixture/coverage-parallel.txt") + }) + + It("works", func() { + session := startGinkgo("./_fixtures/coverage_fixture", "-p", "-cover", "-coverprofile=coverage-parallel.txt") + + Eventually(session).Should(gexec.Exit(0)) + + Ω("./_fixtures/coverage_fixture/coverage-parallel.txt").Should(BeARegularFile()) + }) + }) + + Context("when run in recursive mode specifying a coverprofile", func() { + AfterEach(func() { + removeSuccessfully("./_fixtures/combined_coverage_fixture/coverprofile-recursive.txt") + removeSuccessfully("./_fixtures/combined_coverage_fixture/first_package/coverprofile-recursive.txt") + removeSuccessfully("./_fixtures/combined_coverage_fixture/second_package/coverprofile-recursive.txt") + }) + + It("combines the coverages", func() { + session := startGinkgo("./_fixtures/combined_coverage_fixture", "-outputdir=./", "-r", "-cover", "-coverprofile=coverprofile-recursive.txt") + Eventually(session).Should(gexec.Exit(0)) + + By("generating a combined coverage file", func() { + Ω("./_fixtures/combined_coverage_fixture/coverprofile-recursive.txt").Should(BeARegularFile()) + }) + + By("also generating the single package coverage files", func() { + Ω("./_fixtures/combined_coverage_fixture/first_package/coverprofile-recursive.txt").Should(BeARegularFile()) + Ω("./_fixtures/combined_coverage_fixture/second_package/coverprofile-recursive.txt").Should(BeARegularFile()) + }) + }) + }) + + It("Fails with an error if output dir and coverprofile were set, but the output dir did not exist", func() { + session := startGinkgo("./_fixtures/combined_coverage_fixture", "-outputdir=./all/profiles/here", "-r", "-cover", "-coverprofile=coverage.txt") + + Eventually(session).Should(gexec.Exit(1)) + output := session.Out.Contents() + Ω(string(output)).Should(ContainSubstring("Unable to create combined profile, outputdir does not exist: ./all/profiles/here")) + }) + + Context("when only output dir was set", func() { + AfterEach(func() { + removeSuccessfully("./_fixtures/combined_coverage_fixture/first_package.coverprofile") + removeSuccessfully("./_fixtures/combined_coverage_fixture/first_package/coverage.txt") + removeSuccessfully("./_fixtures/combined_coverage_fixture/second_package.coverprofile") + removeSuccessfully("./_fixtures/combined_coverage_fixture/second_package/coverage.txt") + }) + It("moves coverages", func() { + session := startGinkgo("./_fixtures/combined_coverage_fixture", "-outputdir=./", "-r", "-cover") + Eventually(session).Should(gexec.Exit(0)) + + Ω("./_fixtures/combined_coverage_fixture/first_package.coverprofile").Should(BeARegularFile()) + Ω("./_fixtures/combined_coverage_fixture/second_package.coverprofile").Should(BeARegularFile()) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/fail_test.go b/vendor/github.com/onsi/ginkgo/integration/fail_test.go new file mode 100644 index 000000000..53b2a67b4 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/fail_test.go @@ -0,0 +1,55 @@ +package integration_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Failing Specs", func() { + var pathToTest string + + BeforeEach(func() { + pathToTest = tmpPath("failing") + copyIn(fixturePath("fail_fixture"), pathToTest, false) + }) + + It("should fail in all the possible ways", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(output).ShouldNot(ContainSubstring("NEVER SEE THIS")) + + Ω(output).Should(ContainSubstring("a top level failure on line 9")) + Ω(output).Should(ContainSubstring("fail_fixture_test.go:9")) + Ω(output).Should(ContainSubstring("an async top level failure on line 14")) + Ω(output).Should(ContainSubstring("fail_fixture_test.go:14")) + Ω(output).Should(ContainSubstring("a top level goroutine failure on line 21")) + Ω(output).Should(ContainSubstring("fail_fixture_test.go:21")) + + Ω(output).Should(ContainSubstring("a sync failure")) + Ω(output).Should(MatchRegexp(`Test Panicked\n\s+a sync panic`)) + Ω(output).Should(ContainSubstring("a sync FAIL failure")) + Ω(output).Should(ContainSubstring("async timeout [It]")) + Ω(output).Should(ContainSubstring("Timed out")) + Ω(output).Should(ContainSubstring("an async failure")) + Ω(output).Should(MatchRegexp(`Test Panicked\n\s+an async panic`)) + Ω(output).Should(ContainSubstring("an async FAIL failure")) + Ω(output).Should(ContainSubstring("a goroutine FAIL failure")) + Ω(output).Should(ContainSubstring("a goroutine failure")) + Ω(output).Should(MatchRegexp(`Test Panicked\n\s+a goroutine panic`)) + Ω(output).Should(ContainSubstring("a measure failure")) + Ω(output).Should(ContainSubstring("a measure FAIL failure")) + Ω(output).Should(MatchRegexp(`Test Panicked\n\s+a measure panic`)) + + Ω(output).Should(ContainSubstring("a top level specify")) + Ω(output).ShouldNot(ContainSubstring("ginkgo_dsl.go")) + // depending on the go version this could be the first line of the Specify + // block (>= go1.9) or the last line of the Specify block (< go1.9) + Ω(output).Should(Or(ContainSubstring("fail_fixture_test.go:101"), ContainSubstring("fail_fixture_test.go:103"))) + Ω(output).Should(ContainSubstring("fail_fixture_test.go:102")) + + Ω(output).Should(ContainSubstring("0 Passed | 17 Failed")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/flags_test.go b/vendor/github.com/onsi/ginkgo/integration/flags_test.go new file mode 100644 index 000000000..d84eb46cc --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/flags_test.go @@ -0,0 +1,237 @@ +package integration_test + +import ( + "io/ioutil" + "os" + "path/filepath" + "strings" + + . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/types" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Flags Specs", func() { + var pathToTest string + + BeforeEach(func() { + pathToTest = tmpPath("flags") + copyIn(fixturePath("flags_tests"), pathToTest, false) + }) + + getRandomOrders := func(output string) []int { + return []int{strings.Index(output, "RANDOM_A"), strings.Index(output, "RANDOM_B"), strings.Index(output, "RANDOM_C")} + } + + It("normally passes, runs measurements, prints out noisy pendings, does not randomize tests, and honors the programmatic focus", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Ran 3 samples:"), "has a measurement") + Ω(output).Should(ContainSubstring("11 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + Ω(output).Should(ContainSubstring("1 Pending")) + Ω(output).Should(ContainSubstring("3 Skipped")) + Ω(output).Should(ContainSubstring("[PENDING]")) + Ω(output).Should(ContainSubstring("marshmallow")) + Ω(output).Should(ContainSubstring("chocolate")) + Ω(output).Should(ContainSubstring("CUSTOM_FLAG: default")) + Ω(output).Should(ContainSubstring("Detected Programmatic Focus - setting exit status to %d", types.GINKGO_FOCUS_EXIT_CODE)) + Ω(output).ShouldNot(ContainSubstring("smores")) + Ω(output).ShouldNot(ContainSubstring("SLOW TEST")) + Ω(output).ShouldNot(ContainSubstring("should honor -slowSpecThreshold")) + + orders := getRandomOrders(output) + Ω(orders[0]).Should(BeNumerically("<", orders[1])) + Ω(orders[1]).Should(BeNumerically("<", orders[2])) + }) + + It("should run a coverprofile when passed -cover", func() { + session := startGinkgo(pathToTest, "--noColor", "--cover", "--focus=the focused set") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + _, err := os.Stat(filepath.Join(pathToTest, "flags.coverprofile")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(output).Should(ContainSubstring("coverage: ")) + }) + + It("should fail when there are pending tests and it is passed --failOnPending", func() { + session := startGinkgo(pathToTest, "--noColor", "--failOnPending") + Eventually(session).Should(gexec.Exit(1)) + }) + + It("should fail if the test suite takes longer than the timeout", func() { + session := startGinkgo(pathToTest, "--noColor", "--timeout=1ms") + Eventually(session).Should(gexec.Exit(1)) + }) + + It("should not print out pendings when --noisyPendings=false", func() { + session := startGinkgo(pathToTest, "--noColor", "--noisyPendings=false") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).ShouldNot(ContainSubstring("[PENDING]")) + Ω(output).Should(ContainSubstring("1 Pending")) + }) + + It("should override the programmatic focus when told to focus", func() { + session := startGinkgo(pathToTest, "--noColor", "--focus=smores") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("marshmallow")) + Ω(output).Should(ContainSubstring("chocolate")) + Ω(output).Should(ContainSubstring("smores")) + Ω(output).Should(ContainSubstring("3 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + Ω(output).Should(ContainSubstring("0 Pending")) + Ω(output).Should(ContainSubstring("12 Skipped")) + }) + + It("should override the programmatic focus when told to skip", func() { + session := startGinkgo(pathToTest, "--noColor", "--skip=marshmallow|failing|flaky") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).ShouldNot(ContainSubstring("marshmallow")) + Ω(output).Should(ContainSubstring("chocolate")) + Ω(output).Should(ContainSubstring("smores")) + Ω(output).Should(ContainSubstring("11 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + Ω(output).Should(ContainSubstring("1 Pending")) + Ω(output).Should(ContainSubstring("3 Skipped")) + }) + + It("should run the race detector when told to", func() { + session := startGinkgo(pathToTest, "--noColor", "--race") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("WARNING: DATA RACE")) + }) + + It("should randomize tests when told to", func() { + session := startGinkgo(pathToTest, "--noColor", "--randomizeAllSpecs", "--seed=17") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + orders := getRandomOrders(output) + Ω(orders[0]).ShouldNot(BeNumerically("<", orders[1])) + }) + + It("should skip measurements when told to", func() { + session := startGinkgo(pathToTest, "--skipMeasurements") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).ShouldNot(ContainSubstring("Ran 3 samples:"), "has a measurement") + Ω(output).Should(ContainSubstring("4 Skipped")) + }) + + It("should watch for slow specs", func() { + session := startGinkgo(pathToTest, "--slowSpecThreshold=0.05") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("SLOW TEST")) + Ω(output).Should(ContainSubstring("should honor -slowSpecThreshold")) + }) + + It("should pass additional arguments in", func() { + session := startGinkgo(pathToTest, "--", "--customFlag=madagascar") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("CUSTOM_FLAG: madagascar")) + }) + + It("should print out full stack traces for failures when told to", func() { + session := startGinkgo(pathToTest, "--focus=a failing test", "--trace") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Full Stack Trace")) + }) + + It("should fail fast when told to", func() { + pathToTest = tmpPath("fail") + copyIn(fixturePath("fail_fixture"), pathToTest, false) + session := startGinkgo(pathToTest, "--failFast") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("1 Failed")) + Ω(output).Should(ContainSubstring("16 Skipped")) + }) + + Context("with a flaky test", func() { + It("should normally fail", func() { + session := startGinkgo(pathToTest, "--focus=flaky") + Eventually(session).Should(gexec.Exit(1)) + }) + + It("should pass if retries are requested", func() { + session := startGinkgo(pathToTest, "--focus=flaky --flakeAttempts=2") + Eventually(session).Should(gexec.Exit(0)) + }) + }) + + It("should perform a dry run when told to", func() { + pathToTest = tmpPath("fail") + copyIn(fixturePath("fail_fixture"), pathToTest, false) + session := startGinkgo(pathToTest, "--dryRun", "-v") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("synchronous failures")) + Ω(output).Should(ContainSubstring("17 Specs")) + Ω(output).Should(ContainSubstring("0 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + }) + + regextest := func(regexOption string, skipOrFocus string) string { + pathToTest = tmpPath("passing") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + session := startGinkgo(pathToTest, regexOption, "--dryRun", "-v", skipOrFocus) + Eventually(session).Should(gexec.Exit(0)) + return string(session.Out.Contents()) + } + + It("regexScansFilePath (enabled) should skip and focus on file names", func() { + output := regextest("-regexScansFilePath=true", "-skip=/passing/") // everything gets skipped (nothing runs) + Ω(output).Should(ContainSubstring("0 of 4 Specs")) + output = regextest("-regexScansFilePath=true", "-focus=/passing/") // everything gets focused (everything runs) + Ω(output).Should(ContainSubstring("4 of 4 Specs")) + }) + + It("regexScansFilePath (disabled) should not effect normal filtering", func() { + output := regextest("-regexScansFilePath=false", "-skip=/passing/") // nothing gets skipped (everything runs) + Ω(output).Should(ContainSubstring("4 of 4 Specs")) + output = regextest("-regexScansFilePath=false", "-focus=/passing/") // nothing gets focused (nothing runs) + Ω(output).Should(ContainSubstring("0 of 4 Specs")) + }) + + It("should honor compiler flags", func() { + session := startGinkgo(pathToTest, "-gcflags=-importmap 'math=math/cmplx'") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + Ω(output).Should(ContainSubstring("NaN returns complex128")) + }) + + It("should honor covermode flag", func() { + session := startGinkgo(pathToTest, "--noColor", "--covermode=count", "--focus=the focused set") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + Ω(output).Should(ContainSubstring("coverage: ")) + + coverageFile := filepath.Join(pathToTest, "flags.coverprofile") + _, err := os.Stat(coverageFile) + Ω(err).ShouldNot(HaveOccurred()) + contents, err := ioutil.ReadFile(coverageFile) + Ω(err).ShouldNot(HaveOccurred()) + Ω(contents).Should(ContainSubstring("mode: count")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/integration.go b/vendor/github.com/onsi/ginkgo/integration/integration.go new file mode 100644 index 000000000..76ab1b728 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/integration.go @@ -0,0 +1 @@ +package integration diff --git a/vendor/github.com/onsi/ginkgo/integration/integration_suite_test.go b/vendor/github.com/onsi/ginkgo/integration/integration_suite_test.go new file mode 100644 index 000000000..32ec741c9 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/integration_suite_test.go @@ -0,0 +1,129 @@ +package integration_test + +import ( + "io" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" + + "testing" + "time" +) + +var tmpDir string +var pathToGinkgo string + +func TestIntegration(t *testing.T) { + SetDefaultEventuallyTimeout(30 * time.Second) + RegisterFailHandler(Fail) + RunSpecs(t, "Integration Suite") +} + +var _ = SynchronizedBeforeSuite(func() []byte { + pathToGinkgo, err := gexec.Build("github.com/onsi/ginkgo/ginkgo") + Ω(err).ShouldNot(HaveOccurred()) + return []byte(pathToGinkgo) +}, func(computedPathToGinkgo []byte) { + pathToGinkgo = string(computedPathToGinkgo) +}) + +var _ = BeforeEach(func() { + var err error + tmpDir, err = ioutil.TempDir("", "ginkgo-run") + Ω(err).ShouldNot(HaveOccurred()) +}) + +var _ = AfterEach(func() { + err := os.RemoveAll(tmpDir) + Ω(err).ShouldNot(HaveOccurred()) +}) + +var _ = SynchronizedAfterSuite(func() {}, func() { + gexec.CleanupBuildArtifacts() +}) + +func tmpPath(destination string) string { + return filepath.Join(tmpDir, destination) +} + +func fixturePath(name string) string { + return filepath.Join("_fixtures", name) +} + +func copyIn(sourcePath, destinationPath string, recursive bool) { + err := os.MkdirAll(destinationPath, 0777) + Expect(err).NotTo(HaveOccurred()) + + files, err := ioutil.ReadDir(sourcePath) + Expect(err).NotTo(HaveOccurred()) + for _, f := range files { + srcPath := filepath.Join(sourcePath, f.Name()) + dstPath := filepath.Join(destinationPath, f.Name()) + if f.IsDir() { + if recursive { + copyIn(srcPath, dstPath, recursive) + } + continue + } + + src, err := os.Open(srcPath) + + Expect(err).NotTo(HaveOccurred()) + defer src.Close() + + dst, err := os.Create(dstPath) + Expect(err).NotTo(HaveOccurred()) + defer dst.Close() + + _, err = io.Copy(dst, src) + Expect(err).NotTo(HaveOccurred()) + } +} + +func sameFile(filePath, otherFilePath string) bool { + content, readErr := ioutil.ReadFile(filePath) + Expect(readErr).NotTo(HaveOccurred()) + otherContent, readErr := ioutil.ReadFile(otherFilePath) + Expect(readErr).NotTo(HaveOccurred()) + Expect(string(content)).To(Equal(string(otherContent))) + return true +} + +func sameFolder(sourcePath, destinationPath string) bool { + files, err := ioutil.ReadDir(sourcePath) + Expect(err).NotTo(HaveOccurred()) + for _, f := range files { + srcPath := filepath.Join(sourcePath, f.Name()) + dstPath := filepath.Join(destinationPath, f.Name()) + if f.IsDir() { + sameFolder(srcPath, dstPath) + continue + } + Expect(sameFile(srcPath, dstPath)).To(BeTrue()) + } + return true +} + +func ginkgoCommand(dir string, args ...string) *exec.Cmd { + cmd := exec.Command(pathToGinkgo, args...) + cmd.Dir = dir + + return cmd +} + +func startGinkgo(dir string, args ...string) *gexec.Session { + cmd := ginkgoCommand(dir, args...) + session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + return session +} + +func removeSuccessfully(path string) { + err := os.RemoveAll(path) + Expect(err).NotTo(HaveOccurred()) +} diff --git a/vendor/github.com/onsi/ginkgo/integration/interrupt_test.go b/vendor/github.com/onsi/ginkgo/integration/interrupt_test.go new file mode 100644 index 000000000..d4158b806 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/interrupt_test.go @@ -0,0 +1,51 @@ +package integration_test + +import ( + "os/exec" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Interrupt", func() { + var pathToTest string + BeforeEach(func() { + pathToTest = tmpPath("hanging") + copyIn(fixturePath("hanging_suite"), pathToTest, false) + }) + + 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() { + Ω(session).Should(gbytes.Say("Just beginning")) + Ω(session).Should(gbytes.Say("Almost there...")) + Ω(session).Should(gbytes.Say("Hanging Out")) + }) + + It("should run the AfterSuite", func() { + Ω(session).Should(gbytes.Say("Heading Out After Suite")) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/precompiled_test.go b/vendor/github.com/onsi/ginkgo/integration/precompiled_test.go new file mode 100644 index 000000000..55724a9b8 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/precompiled_test.go @@ -0,0 +1,53 @@ +package integration_test + +import ( + "os" + "os/exec" + "path/filepath" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("ginkgo build", func() { + var pathToTest string + + BeforeEach(func() { + pathToTest = tmpPath("passing_ginkgo_tests") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + session := startGinkgo(pathToTest, "build") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + Ω(output).Should(ContainSubstring("Compiling passing_ginkgo_tests")) + Ω(output).Should(ContainSubstring("compiled passing_ginkgo_tests.test")) + }) + + It("should build a test binary", func() { + _, err := os.Stat(filepath.Join(pathToTest, "passing_ginkgo_tests.test")) + Ω(err).ShouldNot(HaveOccurred()) + }) + + It("should be possible to run the test binary directly", func() { + cmd := exec.Command("./passing_ginkgo_tests.test") + cmd.Dir = pathToTest + session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + Eventually(session).Should(gexec.Exit(0)) + Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite")) + }) + + It("should be possible to run the test binary via ginkgo", func() { + session := startGinkgo(pathToTest, "./passing_ginkgo_tests.test") + Eventually(session).Should(gexec.Exit(0)) + Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite")) + }) + + It("should be possible to run the test binary in parallel", func() { + session := startGinkgo(pathToTest, "--nodes=4", "--noColor", "./passing_ginkgo_tests.test") + Eventually(session).Should(gexec.Exit(0)) + Ω(session).Should(gbytes.Say("Running Suite: Passing_ginkgo_tests Suite")) + Ω(session).Should(gbytes.Say("Running in parallel across 4 nodes")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/progress_test.go b/vendor/github.com/onsi/ginkgo/integration/progress_test.go new file mode 100644 index 000000000..cda86b6ea --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/progress_test.go @@ -0,0 +1,94 @@ +package integration_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Emitting progress", func() { + var pathToTest string + var session *gexec.Session + var args []string + + BeforeEach(func() { + args = []string{"--noColor"} + pathToTest = tmpPath("progress") + copyIn(fixturePath("progress_fixture"), pathToTest, false) + }) + + JustBeforeEach(func() { + session = startGinkgo(pathToTest, args...) + Eventually(session).Should(gexec.Exit(0)) + }) + + Context("with the -progress flag, but no -v flag", func() { + BeforeEach(func() { + args = append(args, "-progress") + }) + + It("should not emit progress", func() { + Ω(session).ShouldNot(gbytes.Say("[bB]efore")) + }) + }) + + Context("with the -v flag", func() { + BeforeEach(func() { + args = append(args, "-v") + }) + + It("should not emit progress", func() { + Ω(session).ShouldNot(gbytes.Say(`\[BeforeEach\]`)) + Ω(session).Should(gbytes.Say(`>outer before<`)) + }) + }) + + Context("with the -progress flag and the -v flag", func() { + BeforeEach(func() { + args = append(args, "-progress", "-v") + }) + + It("should emit progress (by writing to the GinkgoWriter)", func() { + // First spec + + Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer before<`)) + + Ω(session).Should(gbytes.Say(`\[BeforeEach\] Inner Context`)) + Ω(session).Should(gbytes.Say(`>inner before<`)) + + Ω(session).Should(gbytes.Say(`\[BeforeEach\] when Inner When`)) + Ω(session).Should(gbytes.Say(`>inner before<`)) + + Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer just before<`)) + + Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] Inner Context`)) + Ω(session).Should(gbytes.Say(`>inner just before<`)) + + Ω(session).Should(gbytes.Say(`\[It\] should emit progress as it goes`)) + Ω(session).Should(gbytes.Say(`>it<`)) + + Ω(session).Should(gbytes.Say(`\[AfterEach\] Inner Context`)) + Ω(session).Should(gbytes.Say(`>inner after<`)) + + Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer after<`)) + + // Second spec + + Ω(session).Should(gbytes.Say(`\[BeforeEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer before<`)) + + Ω(session).Should(gbytes.Say(`\[JustBeforeEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer just before<`)) + + Ω(session).Should(gbytes.Say(`\[It\] should emit progress as it goes`)) + Ω(session).Should(gbytes.Say(`>specify<`)) + + Ω(session).Should(gbytes.Say(`\[AfterEach\] ProgressFixture`)) + Ω(session).Should(gbytes.Say(`>outer after<`)) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/run_test.go b/vendor/github.com/onsi/ginkgo/integration/run_test.go new file mode 100644 index 000000000..6c270b61b --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/run_test.go @@ -0,0 +1,483 @@ +package integration_test + +import ( + "fmt" + "io/ioutil" + "os" + "regexp" + "runtime" + "strings" + + . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/types" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Running Specs", func() { + var pathToTest string + + isWindows := (runtime.GOOS == "windows") + denoter := "•" + + if isWindows { + denoter = "+" + } + + Context("when pointed at the current directory", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + }) + + It("should run the tests in the working directory", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring(strings.Repeat(denoter, 4))) + Ω(output).Should(ContainSubstring("SUCCESS! -- 4 Passed")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + + Context("when passed an explicit package to run", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + }) + + It("should run the ginkgo style tests", func() { + session := startGinkgo(tmpDir, "--noColor", pathToTest) + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring(strings.Repeat(denoter, 4))) + Ω(output).Should(ContainSubstring("SUCCESS! -- 4 Passed")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + + Context("when passed a number of packages to run", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + otherPathToTest := tmpPath("other") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + copyIn(fixturePath("more_ginkgo_tests"), otherPathToTest, false) + }) + + It("should run the ginkgo style tests", func() { + session := startGinkgo(tmpDir, "--noColor", "--succinct=false", "ginkgo", "./other") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + + Context("when passed a number of packages to run, some of which have focused tests", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + otherPathToTest := tmpPath("other") + focusedPathToTest := tmpPath("focused") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + copyIn(fixturePath("more_ginkgo_tests"), otherPathToTest, false) + copyIn(fixturePath("focused_fixture"), focusedPathToTest, false) + }) + + It("should exit with a status code of 2 and explain why", func() { + session := startGinkgo(tmpDir, "--noColor", "--succinct=false", "-r") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + Ω(output).Should(ContainSubstring("Detected Programmatic Focus - setting exit status to %d", types.GINKGO_FOCUS_EXIT_CODE)) + }) + + Context("when the GINKGO_EDITOR_INTEGRATION environment variable is set", func() { + BeforeEach(func() { + os.Setenv("GINKGO_EDITOR_INTEGRATION", "true") + }) + AfterEach(func() { + os.Setenv("GINKGO_EDITOR_INTEGRATION", "") + }) + It("should exit with a status code of 0 to allow a coverage file to be generated", func() { + session := startGinkgo(tmpDir, "--noColor", "--succinct=false", "-r") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + }) + + Context("when told to skipPackages", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + otherPathToTest := tmpPath("other") + focusedPathToTest := tmpPath("focused") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + copyIn(fixturePath("more_ginkgo_tests"), otherPathToTest, false) + copyIn(fixturePath("focused_fixture"), focusedPathToTest, false) + }) + + It("should skip packages that match the list", func() { + session := startGinkgo(tmpDir, "--noColor", "--skipPackage=other,focused", "-r") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Passing_ginkgo_tests Suite")) + Ω(output).ShouldNot(ContainSubstring("More_ginkgo_tests Suite")) + Ω(output).ShouldNot(ContainSubstring("Focused_fixture Suite")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + + Context("when all packages are skipped", func() { + It("should not run anything, but still exit 0", func() { + session := startGinkgo(tmpDir, "--noColor", "--skipPackage=other,focused,ginkgo", "-r") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("All tests skipped!")) + Ω(output).ShouldNot(ContainSubstring("Passing_ginkgo_tests Suite")) + Ω(output).ShouldNot(ContainSubstring("More_ginkgo_tests Suite")) + Ω(output).ShouldNot(ContainSubstring("Focused_fixture Suite")) + Ω(output).ShouldNot(ContainSubstring("Test Suite Passed")) + }) + }) + }) + + Context("when there are no tests to run", func() { + It("should exit 1", func() { + session := startGinkgo(tmpDir, "--noColor", "--skipPackage=other,focused", "-r") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Err.Contents()) + + Ω(output).Should(ContainSubstring("Found no test suites")) + }) + }) + + Context("when there are test files but `go test` reports there are no tests to run", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("no_test_fn"), pathToTest, false) + }) + + It("suggests running ginkgo bootstrap", func() { + session := startGinkgo(tmpDir, "--noColor", "--skipPackage=other,focused", "-r") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Err.Contents()) + + Ω(output).Should(ContainSubstring(`Found no test suites, did you forget to run "ginkgo bootstrap"?`)) + }) + + It("fails if told to requireSuite", func() { + session := startGinkgo(tmpDir, "--noColor", "--skipPackage=other,focused", "-r", "-requireSuite") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Err.Contents()) + + Ω(output).Should(ContainSubstring(`Found no test suites, did you forget to run "ginkgo bootstrap"?`)) + }) + }) + + Context("when told to randomizeSuites", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + otherPathToTest := tmpPath("other") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + copyIn(fixturePath("more_ginkgo_tests"), otherPathToTest, false) + }) + + It("should skip packages that match the regexp", func() { + session := startGinkgo(tmpDir, "--noColor", "--randomizeSuites", "-r", "--seed=2") + Eventually(session).Should(gexec.Exit(0)) + + Ω(session).Should(gbytes.Say("More_ginkgo_tests Suite")) + Ω(session).Should(gbytes.Say("Passing_ginkgo_tests Suite")) + + session = startGinkgo(tmpDir, "--noColor", "--randomizeSuites", "-r", "--seed=3") + Eventually(session).Should(gexec.Exit(0)) + + Ω(session).Should(gbytes.Say("Passing_ginkgo_tests Suite")) + Ω(session).Should(gbytes.Say("More_ginkgo_tests Suite")) + }) + }) + + Context("when pointed at a package with xunit style tests", func() { + BeforeEach(func() { + pathToTest = tmpPath("xunit") + copyIn(fixturePath("xunit_tests"), pathToTest, false) + }) + + It("should run the xunit style tests", func() { + session := startGinkgo(pathToTest) + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("--- PASS: TestAlwaysTrue")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + + Context("when pointed at a package with no tests", func() { + BeforeEach(func() { + pathToTest = tmpPath("no_tests") + copyIn(fixturePath("no_tests"), pathToTest, false) + }) + + It("should fail", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(1)) + + Ω(session.Err.Contents()).Should(ContainSubstring("Found no test suites")) + }) + }) + + Context("when pointed at a package that fails to compile", func() { + BeforeEach(func() { + pathToTest = tmpPath("does_not_compile") + copyIn(fixturePath("does_not_compile"), pathToTest, false) + }) + + It("should fail", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Failed to compile")) + }) + }) + + Context("when running in parallel", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + }) + + Context("with a specific number of -nodes", func() { + It("should use the specified number of nodes", func() { + session := startGinkgo(pathToTest, "--noColor", "-succinct", "-nodes=2") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4 specs - 2 nodes [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]s`, regexp.QuoteMeta(denoter))) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + + Context("with -p", func() { + It("it should autocompute the number of nodes", func() { + session := startGinkgo(pathToTest, "--noColor", "-succinct", "-p") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + nodes := runtime.NumCPU() + if nodes == 1 { + Skip("Can't test parallel testings with 1 CPU") + } + if nodes > 4 { + nodes = nodes - 1 + } + Ω(output).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4 specs - %d nodes [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]?s`, nodes, regexp.QuoteMeta(denoter))) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + }) + + Context("when running in parallel with -debug", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("debug_parallel_fixture"), pathToTest, false) + }) + + Context("without -v", func() { + It("should emit node output to files on disk", func() { + session := startGinkgo(pathToTest, "--nodes=2", "--debug") + Eventually(session).Should(gexec.Exit(0)) + + f0, err := ioutil.ReadFile(pathToTest + "/ginkgo-node-1.log") + Ω(err).ShouldNot(HaveOccurred()) + f1, err := ioutil.ReadFile(pathToTest + "/ginkgo-node-2.log") + Ω(err).ShouldNot(HaveOccurred()) + content := string(append(f0, f1...)) + + for i := 0; i < 10; i += 1 { + Ω(content).Should(ContainSubstring("StdOut %d\n", i)) + Ω(content).Should(ContainSubstring("GinkgoWriter %d\n", i)) + } + }) + }) + + Context("without -v", func() { + It("should emit node output to files on disk, without duplicating the GinkgoWriter output", func() { + session := startGinkgo(pathToTest, "--nodes=2", "--debug", "-v") + Eventually(session).Should(gexec.Exit(0)) + + f0, err := ioutil.ReadFile(pathToTest + "/ginkgo-node-1.log") + Ω(err).ShouldNot(HaveOccurred()) + f1, err := ioutil.ReadFile(pathToTest + "/ginkgo-node-2.log") + Ω(err).ShouldNot(HaveOccurred()) + content := string(append(f0, f1...)) + + out := strings.Split(content, "GinkgoWriter 2") + Ω(out).Should(HaveLen(2)) + }) + }) + }) + + Context("when streaming in parallel", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + }) + + It("should print output in realtime", func() { + session := startGinkgo(pathToTest, "--noColor", "-stream", "-nodes=2") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring(`[1] Parallel test node 1/2.`)) + Ω(output).Should(ContainSubstring(`[2] Parallel test node 2/2.`)) + Ω(output).Should(ContainSubstring(`[1] SUCCESS!`)) + Ω(output).Should(ContainSubstring(`[2] SUCCESS!`)) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + + Context("when running recursively", func() { + BeforeEach(func() { + passingTest := tmpPath("A") + otherPassingTest := tmpPath("E") + copyIn(fixturePath("passing_ginkgo_tests"), passingTest, false) + copyIn(fixturePath("more_ginkgo_tests"), otherPassingTest, false) + }) + + Context("when all the tests pass", func() { + Context("with the -r flag", func() { + It("should run all the tests (in succinct mode) and succeed", func() { + session := startGinkgo(tmpDir, "--noColor", "-r", ".") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + outputLines := strings.Split(output, "\n") + Ω(outputLines[0]).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4/4 specs [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(outputLines[1]).Should(MatchRegexp(`\[\d+\] More_ginkgo_tests Suite - 2/2 specs [%s]{2} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + Context("with a trailing /...", func() { + It("should run all the tests (in succinct mode) and succeed", func() { + session := startGinkgo(tmpDir, "--noColor", "./...") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + outputLines := strings.Split(output, "\n") + Ω(outputLines[0]).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4/4 specs [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(outputLines[1]).Should(MatchRegexp(`\[\d+\] More_ginkgo_tests Suite - 2/2 specs [%s]{2} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + }) + }) + }) + + Context("when one of the packages has a failing tests", func() { + BeforeEach(func() { + failingTest := tmpPath("C") + copyIn(fixturePath("failing_ginkgo_tests"), failingTest, false) + }) + + It("should fail and stop running tests", func() { + session := startGinkgo(tmpDir, "--noColor", "-r") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + outputLines := strings.Split(output, "\n") + Ω(outputLines[0]).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4/4 specs [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(outputLines[1]).Should(MatchRegexp(`\[\d+\] Failing_ginkgo_tests Suite - 2/2 specs`)) + Ω(output).Should(ContainSubstring(fmt.Sprintf("%s Failure", denoter))) + Ω(output).ShouldNot(ContainSubstring("More_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Test Suite Failed")) + + Ω(output).Should(ContainSubstring("Summarizing 1 Failure:")) + Ω(output).Should(ContainSubstring("[Fail] FailingGinkgoTests [It] should fail")) + }) + }) + + Context("when one of the packages fails to compile", func() { + BeforeEach(func() { + doesNotCompileTest := tmpPath("C") + copyIn(fixturePath("does_not_compile"), doesNotCompileTest, false) + }) + + It("should fail and stop running tests", func() { + session := startGinkgo(tmpDir, "--noColor", "-r") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + outputLines := strings.Split(output, "\n") + Ω(outputLines[0]).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4/4 specs [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(outputLines[1]).Should(ContainSubstring("Failed to compile C:")) + Ω(output).ShouldNot(ContainSubstring("More_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Test Suite Failed")) + }) + }) + + Context("when either is the case, but the keepGoing flag is set", func() { + BeforeEach(func() { + doesNotCompileTest := tmpPath("B") + copyIn(fixturePath("does_not_compile"), doesNotCompileTest, false) + + failingTest := tmpPath("C") + copyIn(fixturePath("failing_ginkgo_tests"), failingTest, false) + }) + + It("should soldier on", func() { + session := startGinkgo(tmpDir, "--noColor", "-r", "-keepGoing") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + outputLines := strings.Split(output, "\n") + Ω(outputLines[0]).Should(MatchRegexp(`\[\d+\] Passing_ginkgo_tests Suite - 4/4 specs [%s]{4} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(outputLines[1]).Should(ContainSubstring("Failed to compile B:")) + Ω(output).Should(MatchRegexp(`\[\d+\] Failing_ginkgo_tests Suite - 2/2 specs`)) + Ω(output).Should(ContainSubstring(fmt.Sprintf("%s Failure", denoter))) + Ω(output).Should(MatchRegexp(`\[\d+\] More_ginkgo_tests Suite - 2/2 specs [%s]{2} SUCCESS! \d+(\.\d+)?[muµ]s PASS`, regexp.QuoteMeta(denoter))) + Ω(output).Should(ContainSubstring("Test Suite Failed")) + }) + }) + }) + + Context("when told to keep going --untilItFails", func() { + BeforeEach(func() { + copyIn(fixturePath("eventually_failing"), tmpDir, false) + }) + + It("should keep rerunning the tests, until a failure occurs", func() { + session := startGinkgo(tmpDir, "--untilItFails", "--noColor") + Eventually(session).Should(gexec.Exit(1)) + Ω(session).Should(gbytes.Say("This was attempt #1")) + Ω(session).Should(gbytes.Say("This was attempt #2")) + Ω(session).Should(gbytes.Say("Tests failed on attempt #3")) + + //it should change the random seed between each test + lines := strings.Split(string(session.Out.Contents()), "\n") + randomSeeds := []string{} + for _, line := range lines { + if strings.Contains(line, "Random Seed:") { + randomSeeds = append(randomSeeds, strings.Split(line, ": ")[1]) + } + } + Ω(randomSeeds[0]).ShouldNot(Equal(randomSeeds[1])) + Ω(randomSeeds[1]).ShouldNot(Equal(randomSeeds[2])) + Ω(randomSeeds[0]).ShouldNot(Equal(randomSeeds[2])) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/skip_test.go b/vendor/github.com/onsi/ginkgo/integration/skip_test.go new file mode 100644 index 000000000..f0fc9d5ee --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/skip_test.go @@ -0,0 +1,43 @@ +package integration_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Skipping Specs", func() { + var pathToTest string + + BeforeEach(func() { + pathToTest = tmpPath("skipping") + copyIn(fixturePath("skip_fixture"), pathToTest, false) + }) + + It("should skip in all the possible ways", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).ShouldNot(ContainSubstring("NEVER SEE THIS")) + + Ω(output).Should(ContainSubstring("a top level skip on line 9")) + Ω(output).Should(ContainSubstring("skip_fixture_test.go:9")) + Ω(output).Should(ContainSubstring("an async top level skip on line 14")) + Ω(output).Should(ContainSubstring("skip_fixture_test.go:14")) + Ω(output).Should(ContainSubstring("a top level goroutine skip on line 21")) + Ω(output).Should(ContainSubstring("skip_fixture_test.go:21")) + + Ω(output).Should(ContainSubstring("a sync SKIP")) + Ω(output).Should(ContainSubstring("an async SKIP")) + Ω(output).Should(ContainSubstring("a goroutine SKIP")) + Ω(output).Should(ContainSubstring("a measure SKIP")) + + Ω(output).Should(ContainSubstring("S [SKIPPING] in Spec Setup (BeforeEach) [")) + Ω(output).Should(ContainSubstring("a BeforeEach SKIP")) + Ω(output).Should(ContainSubstring("S [SKIPPING] in Spec Teardown (AfterEach) [")) + Ω(output).Should(ContainSubstring("an AfterEach SKIP")) + + Ω(output).Should(ContainSubstring("0 Passed | 0 Failed | 0 Pending | 9 Skipped")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/subcommand_test.go b/vendor/github.com/onsi/ginkgo/integration/subcommand_test.go new file mode 100644 index 000000000..fec197f56 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/subcommand_test.go @@ -0,0 +1,419 @@ +package integration_test + +import ( + "io/ioutil" + "os" + "path/filepath" + "strings" + + . "github.com/onsi/ginkgo" + "github.com/onsi/ginkgo/types" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Subcommand", func() { + Describe("ginkgo bootstrap", func() { + var pkgPath string + BeforeEach(func() { + pkgPath = tmpPath("foo") + os.Mkdir(pkgPath, 0777) + }) + + It("should generate a bootstrap file, as long as one does not exist", func() { + session := startGinkgo(pkgPath, "bootstrap") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_suite_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_test")) + Ω(content).Should(ContainSubstring("func TestFoo(t *testing.T) {")) + Ω(content).Should(ContainSubstring("RegisterFailHandler")) + Ω(content).Should(ContainSubstring("RunSpecs")) + + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/ginkgo"`)) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/gomega"`)) + + session = startGinkgo(pkgPath, "bootstrap") + Eventually(session).Should(gexec.Exit(1)) + output = session.Out.Contents() + Ω(output).Should(ContainSubstring("foo_suite_test.go already exists")) + }) + + It("should import nodot declarations when told to", func() { + session := startGinkgo(pkgPath, "bootstrap", "--nodot") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_suite_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_test")) + Ω(content).Should(ContainSubstring("func TestFoo(t *testing.T) {")) + Ω(content).Should(ContainSubstring("RegisterFailHandler")) + Ω(content).Should(ContainSubstring("RunSpecs")) + + Ω(content).Should(ContainSubstring("var It = ginkgo.It")) + Ω(content).Should(ContainSubstring("var Ω = gomega.Ω")) + + Ω(content).Should(ContainSubstring("\t" + `"github.com/onsi/ginkgo"`)) + Ω(content).Should(ContainSubstring("\t" + `"github.com/onsi/gomega"`)) + }) + + It("should generate an agouti bootstrap file when told to", func() { + session := startGinkgo(pkgPath, "bootstrap", "--agouti") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_suite_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_test")) + Ω(content).Should(ContainSubstring("func TestFoo(t *testing.T) {")) + Ω(content).Should(ContainSubstring("RegisterFailHandler")) + Ω(content).Should(ContainSubstring("RunSpecs")) + + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/ginkgo"`)) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/gomega"`)) + Ω(content).Should(ContainSubstring("\t" + `"github.com/sclevine/agouti"`)) + }) + + It("should generate a bootstrap file using a template when told to", func() { + templateFile := filepath.Join(pkgPath, ".bootstrap") + ioutil.WriteFile(templateFile, []byte(`package {{.Package}} + + import ( + {{.GinkgoImport}} + {{.GomegaImport}} + + "testing" + "binary" + ) + + func Test{{.FormattedName}}(t *testing.T) { + // This is a {{.Package}} test + }`), 0666) + session := startGinkgo(pkgPath, "bootstrap", "--template", templateFile) + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_suite_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_test")) + Ω(content).Should(ContainSubstring(`. "github.com/onsi/ginkgo"`)) + Ω(content).Should(ContainSubstring(`. "github.com/onsi/gomega"`)) + Ω(content).Should(ContainSubstring(`"binary"`)) + Ω(content).Should(ContainSubstring("// This is a foo_test test")) + }) + }) + + Describe("nodot", func() { + It("should update the declarations in the bootstrap file", func() { + pkgPath := tmpPath("foo") + os.Mkdir(pkgPath, 0777) + + session := startGinkgo(pkgPath, "bootstrap", "--nodot") + Eventually(session).Should(gexec.Exit(0)) + + byteContent, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + + content := string(byteContent) + content = strings.Replace(content, "var It =", "var MyIt =", -1) + content = strings.Replace(content, "var Ω = gomega.Ω\n", "", -1) + + err = ioutil.WriteFile(filepath.Join(pkgPath, "foo_suite_test.go"), []byte(content), os.ModePerm) + Ω(err).ShouldNot(HaveOccurred()) + + session = startGinkgo(pkgPath, "nodot") + Eventually(session).Should(gexec.Exit(0)) + + byteContent, err = ioutil.ReadFile(filepath.Join(pkgPath, "foo_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + + Ω(byteContent).Should(ContainSubstring("var MyIt = ginkgo.It")) + Ω(byteContent).ShouldNot(ContainSubstring("var It = ginkgo.It")) + Ω(byteContent).Should(ContainSubstring("var Ω = gomega.Ω")) + }) + }) + + Describe("ginkgo generate", func() { + var pkgPath string + + BeforeEach(func() { + pkgPath = tmpPath("foo_bar") + os.Mkdir(pkgPath, 0777) + }) + + Context("with no arguments", func() { + It("should generate a test file named after the package", func() { + session := startGinkgo(pkgPath, "generate") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_bar_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_bar_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("FooBar", func() {`)) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/ginkgo"`)) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/gomega"`)) + + session = startGinkgo(pkgPath, "generate") + Eventually(session).Should(gexec.Exit(1)) + output = session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_bar_test.go already exists")) + }) + }) + + Context("with an argument of the form: foo", func() { + It("should generate a test file named after the argument", func() { + session := startGinkgo(pkgPath, "generate", "baz_buzz") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("baz_buzz_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "baz_buzz_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("BazBuzz", func() {`)) + }) + }) + + Context("with an argument of the form: foo.go", func() { + It("should generate a test file named after the argument", func() { + session := startGinkgo(pkgPath, "generate", "baz_buzz.go") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("baz_buzz_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "baz_buzz_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("BazBuzz", func() {`)) + + }) + }) + + Context("with an argument of the form: foo_test", func() { + It("should generate a test file named after the argument", func() { + session := startGinkgo(pkgPath, "generate", "baz_buzz_test") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("baz_buzz_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "baz_buzz_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("BazBuzz", func() {`)) + }) + }) + + Context("with an argument of the form: foo_test.go", func() { + It("should generate a test file named after the argument", func() { + session := startGinkgo(pkgPath, "generate", "baz_buzz_test.go") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("baz_buzz_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "baz_buzz_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("BazBuzz", func() {`)) + }) + }) + + Context("with multiple arguments", func() { + It("should generate a test file named after the argument", func() { + session := startGinkgo(pkgPath, "generate", "baz", "buzz") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("baz_test.go")) + Ω(output).Should(ContainSubstring("buzz_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "baz_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("Baz", func() {`)) + + content, err = ioutil.ReadFile(filepath.Join(pkgPath, "buzz_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring(`var _ = Describe("Buzz", func() {`)) + }) + }) + + Context("with nodot", func() { + It("should not import ginkgo or gomega", func() { + session := startGinkgo(pkgPath, "generate", "--nodot") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_bar_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_bar_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).ShouldNot(ContainSubstring("\t" + `. "github.com/onsi/ginkgo"`)) + Ω(content).ShouldNot(ContainSubstring("\t" + `. "github.com/onsi/gomega"`)) + }) + }) + + Context("with agouti", func() { + It("should generate an agouti test file", func() { + session := startGinkgo(pkgPath, "generate", "--agouti") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("foo_bar_test.go")) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "foo_bar_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package foo_bar_test")) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/ginkgo"`)) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/onsi/gomega"`)) + Ω(content).Should(ContainSubstring("\t" + `. "github.com/sclevine/agouti/matchers"`)) + Ω(content).Should(ContainSubstring("\t" + `"github.com/sclevine/agouti"`)) + Ω(content).Should(ContainSubstring("page, err = agoutiDriver.NewPage()")) + }) + }) + }) + + Describe("ginkgo bootstrap/generate", func() { + var pkgPath string + BeforeEach(func() { + pkgPath = tmpPath("some crazy-thing") + os.Mkdir(pkgPath, 0777) + }) + + Context("when the working directory is empty", func() { + It("generates correctly named bootstrap and generate files with a package name derived from the directory", func() { + session := startGinkgo(pkgPath, "bootstrap") + Eventually(session).Should(gexec.Exit(0)) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "some_crazy_thing_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package some_crazy_thing_test")) + Ω(content).Should(ContainSubstring("SomeCrazyThing Suite")) + + session = startGinkgo(pkgPath, "generate") + Eventually(session).Should(gexec.Exit(0)) + + content, err = ioutil.ReadFile(filepath.Join(pkgPath, "some_crazy_thing_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package some_crazy_thing_test")) + Ω(content).Should(ContainSubstring("SomeCrazyThing")) + }) + }) + + Context("when the working directory contains a file with a package name", func() { + BeforeEach(func() { + Ω(ioutil.WriteFile(filepath.Join(pkgPath, "foo.go"), []byte("package main\n\nfunc main() {}"), 0777)).Should(Succeed()) + }) + + It("generates correctly named bootstrap and generate files with the package name", func() { + session := startGinkgo(pkgPath, "bootstrap") + Eventually(session).Should(gexec.Exit(0)) + + content, err := ioutil.ReadFile(filepath.Join(pkgPath, "some_crazy_thing_suite_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package main_test")) + Ω(content).Should(ContainSubstring("SomeCrazyThing Suite")) + + session = startGinkgo(pkgPath, "generate") + Eventually(session).Should(gexec.Exit(0)) + + content, err = ioutil.ReadFile(filepath.Join(pkgPath, "some_crazy_thing_test.go")) + Ω(err).ShouldNot(HaveOccurred()) + Ω(content).Should(ContainSubstring("package main_test")) + Ω(content).Should(ContainSubstring("SomeCrazyThing")) + }) + }) + }) + + Describe("ginkgo blur", func() { + It("should unfocus tests", func() { + pathToTest := tmpPath("focused") + fixture := fixturePath("focused_fixture") + copyIn(fixture, pathToTest, false) + + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE)) + output := session.Out.Contents() + + Ω(string(output)).Should(ContainSubstring("8 Passed")) + Ω(string(output)).Should(ContainSubstring("5 Skipped")) + + session = startGinkgo(pathToTest, "blur") + Eventually(session).Should(gexec.Exit(0)) + output = session.Out.Contents() + Ω(string(output)).ShouldNot(ContainSubstring("expected 'package'")) + + session = startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output = session.Out.Contents() + Ω(string(output)).Should(ContainSubstring("13 Passed")) + Ω(string(output)).Should(ContainSubstring("0 Skipped")) + + Expect(sameFile(filepath.Join(pathToTest, "README.md"), filepath.Join(fixture, "README.md"))).To(BeTrue()) + }) + + It("should ignore the 'vendor' folder", func() { + pathToTest := tmpPath("focused_fixture_with_vendor") + copyIn(fixturePath("focused_fixture_with_vendor"), pathToTest, true) + + session := startGinkgo(pathToTest, "blur") + Eventually(session).Should(gexec.Exit(0)) + + session = startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + Expect(string(output)).To(ContainSubstring("13 Passed")) + Expect(string(output)).To(ContainSubstring("0 Skipped")) + + vendorPath := fixturePath("focused_fixture_with_vendor/vendor") + otherVendorPath := filepath.Join(pathToTest, "vendor") + + Expect(sameFolder(vendorPath, otherVendorPath)).To(BeTrue()) + }) + }) + + Describe("ginkgo version", func() { + It("should print out the version info", func() { + session := startGinkgo("", "version") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(MatchRegexp(`Ginkgo Version \d+\.\d+\.\d+`)) + }) + }) + + Describe("ginkgo help", func() { + It("should print out usage information", func() { + session := startGinkgo("", "help") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Err.Contents()) + + Ω(output).Should(MatchRegexp(`Ginkgo Version \d+\.\d+\.\d+`)) + Ω(output).Should(ContainSubstring("ginkgo watch")) + Ω(output).Should(ContainSubstring("-succinct")) + Ω(output).Should(ContainSubstring("-nodes")) + Ω(output).Should(ContainSubstring("ginkgo generate")) + Ω(output).Should(ContainSubstring("ginkgo help <COMMAND>")) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/suite_command_test.go b/vendor/github.com/onsi/ginkgo/integration/suite_command_test.go new file mode 100644 index 000000000..4aec1bc41 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/suite_command_test.go @@ -0,0 +1,63 @@ +package integration_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Suite Command Specs", func() { + var pathToTest string + + BeforeEach(func() { + pathToTest = tmpPath("suite_command") + copyIn(fixturePath("suite_command_tests"), pathToTest, false) + }) + + It("Runs command after suite echoing out suite data, properly reporting suite name and passing status in successful command output", func() { + command := "-afterSuiteHook=echo THIS IS A (ginkgo-suite-passed) TEST OF THE (ginkgo-suite-name) SYSTEM, THIS IS ONLY A TEST" + expected := "THIS IS A [PASS] TEST OF THE suite_command SYSTEM, THIS IS ONLY A TEST" + session := startGinkgo(pathToTest, command) + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("1 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + Ω(output).Should(ContainSubstring("1 Pending")) + Ω(output).Should(ContainSubstring("0 Skipped")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + Ω(output).Should(ContainSubstring("Post-suite command succeeded:")) + Ω(output).Should(ContainSubstring(expected)) + }) + + It("Runs command after suite reporting that command failed", func() { + command := "-afterSuiteHook=exit 1" + session := startGinkgo(pathToTest, command) + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("1 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + Ω(output).Should(ContainSubstring("1 Pending")) + Ω(output).Should(ContainSubstring("0 Skipped")) + Ω(output).Should(ContainSubstring("Test Suite Passed")) + Ω(output).Should(ContainSubstring("Post-suite command failed:")) + }) + + It("Runs command after suite echoing out suite data, properly reporting suite name and failing status in successful command output", func() { + command := "-afterSuiteHook=echo THIS IS A (ginkgo-suite-passed) TEST OF THE (ginkgo-suite-name) SYSTEM, THIS IS ONLY A TEST" + expected := "THIS IS A [FAIL] TEST OF THE suite_command SYSTEM, THIS IS ONLY A TEST" + session := startGinkgo(pathToTest, "-failOnPending=true", command) + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("1 Passed")) + Ω(output).Should(ContainSubstring("0 Failed")) + Ω(output).Should(ContainSubstring("1 Pending")) + Ω(output).Should(ContainSubstring("0 Skipped")) + Ω(output).Should(ContainSubstring("Test Suite Failed")) + Ω(output).Should(ContainSubstring("Post-suite command succeeded:")) + Ω(output).Should(ContainSubstring(expected)) + }) + +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/suite_setup_test.go b/vendor/github.com/onsi/ginkgo/integration/suite_setup_test.go new file mode 100644 index 000000000..33ff5b983 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/suite_setup_test.go @@ -0,0 +1,178 @@ +package integration_test + +import ( + "strings" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("SuiteSetup", func() { + var pathToTest string + + Context("when the BeforeSuite and AfterSuite pass", func() { + BeforeEach(func() { + pathToTest = tmpPath("suite_setup") + copyIn(fixturePath("passing_suite_setup"), pathToTest, false) + }) + + It("should run the BeforeSuite once, then run all the tests", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(strings.Count(output, "BEFORE SUITE")).Should(Equal(1)) + Ω(strings.Count(output, "AFTER SUITE")).Should(Equal(1)) + }) + + It("should run the BeforeSuite once per parallel node, then run all the tests", func() { + session := startGinkgo(pathToTest, "--noColor", "--nodes=2") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(strings.Count(output, "BEFORE SUITE")).Should(Equal(2)) + Ω(strings.Count(output, "AFTER SUITE")).Should(Equal(2)) + }) + }) + + Context("when the BeforeSuite fails", func() { + BeforeEach(func() { + pathToTest = tmpPath("suite_setup") + copyIn(fixturePath("failing_before_suite"), pathToTest, false) + }) + + It("should run the BeforeSuite once, none of the tests, but it should run the AfterSuite", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(strings.Count(output, "BEFORE SUITE")).Should(Equal(1)) + Ω(strings.Count(output, "Test Panicked")).Should(Equal(1)) + Ω(strings.Count(output, "AFTER SUITE")).Should(Equal(1)) + Ω(output).ShouldNot(ContainSubstring("NEVER SEE THIS")) + }) + + It("should run the BeforeSuite once per parallel node, none of the tests, but it should run the AfterSuite for each node", func() { + session := startGinkgo(pathToTest, "--noColor", "--nodes=2") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(strings.Count(output, "BEFORE SUITE")).Should(Equal(2)) + Ω(strings.Count(output, "Test Panicked")).Should(Equal(2)) + Ω(strings.Count(output, "AFTER SUITE")).Should(Equal(2)) + Ω(output).ShouldNot(ContainSubstring("NEVER SEE THIS")) + }) + }) + + Context("when the AfterSuite fails", func() { + BeforeEach(func() { + pathToTest = tmpPath("suite_setup") + copyIn(fixturePath("failing_after_suite"), pathToTest, false) + }) + + It("should run the BeforeSuite once, none of the tests, but it should run the AfterSuite", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(strings.Count(output, "BEFORE SUITE")).Should(Equal(1)) + Ω(strings.Count(output, "AFTER SUITE")).Should(Equal(1)) + Ω(strings.Count(output, "Test Panicked")).Should(Equal(1)) + Ω(strings.Count(output, "A TEST")).Should(Equal(2)) + }) + + It("should run the BeforeSuite once per parallel node, none of the tests, but it should run the AfterSuite for each node", func() { + session := startGinkgo(pathToTest, "--noColor", "--nodes=2") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(strings.Count(output, "BEFORE SUITE")).Should(Equal(2)) + Ω(strings.Count(output, "AFTER SUITE")).Should(Equal(2)) + Ω(strings.Count(output, "Test Panicked")).Should(Equal(2)) + Ω(strings.Count(output, "A TEST")).Should(Equal(2)) + }) + }) + + Context("With passing synchronized before and after suites", func() { + BeforeEach(func() { + pathToTest = tmpPath("suite_setup") + copyIn(fixturePath("synchronized_setup_tests"), pathToTest, false) + }) + + Context("when run with one node", func() { + It("should do all the work on that one node", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("BEFORE_A_1\nBEFORE_B_1: DATA")) + Ω(output).Should(ContainSubstring("AFTER_A_1\nAFTER_B_1")) + }) + }) + + Context("when run across multiple nodes", func() { + It("should run the first BeforeSuite function (BEFORE_A) on node 1, the second (BEFORE_B) on all the nodes, the first AfterSuite (AFTER_A) on all the nodes, and then the second (AFTER_B) on Node 1 *after* everything else is finished", func() { + session := startGinkgo(pathToTest, "--noColor", "--nodes=3") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("BEFORE_A_1")) + Ω(output).Should(ContainSubstring("BEFORE_B_1: DATA")) + Ω(output).Should(ContainSubstring("BEFORE_B_2: DATA")) + Ω(output).Should(ContainSubstring("BEFORE_B_3: DATA")) + + Ω(output).ShouldNot(ContainSubstring("BEFORE_A_2")) + Ω(output).ShouldNot(ContainSubstring("BEFORE_A_3")) + + Ω(output).Should(ContainSubstring("AFTER_A_1")) + Ω(output).Should(ContainSubstring("AFTER_A_2")) + Ω(output).Should(ContainSubstring("AFTER_A_3")) + Ω(output).Should(ContainSubstring("AFTER_B_1")) + + Ω(output).ShouldNot(ContainSubstring("AFTER_B_2")) + Ω(output).ShouldNot(ContainSubstring("AFTER_B_3")) + }) + }) + + Context("when streaming across multiple nodes", func() { + It("should run the first BeforeSuite function (BEFORE_A) on node 1, the second (BEFORE_B) on all the nodes, the first AfterSuite (AFTER_A) on all the nodes, and then the second (AFTER_B) on Node 1 *after* everything else is finished", func() { + session := startGinkgo(pathToTest, "--noColor", "--nodes=3", "--stream") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("[1] BEFORE_A_1")) + Ω(output).Should(ContainSubstring("[1] BEFORE_B_1: DATA")) + Ω(output).Should(ContainSubstring("[2] BEFORE_B_2: DATA")) + Ω(output).Should(ContainSubstring("[3] BEFORE_B_3: DATA")) + + Ω(output).ShouldNot(ContainSubstring("BEFORE_A_2")) + Ω(output).ShouldNot(ContainSubstring("BEFORE_A_3")) + + Ω(output).Should(ContainSubstring("[1] AFTER_A_1")) + Ω(output).Should(ContainSubstring("[2] AFTER_A_2")) + Ω(output).Should(ContainSubstring("[3] AFTER_A_3")) + Ω(output).Should(ContainSubstring("[1] AFTER_B_1")) + + Ω(output).ShouldNot(ContainSubstring("AFTER_B_2")) + Ω(output).ShouldNot(ContainSubstring("AFTER_B_3")) + }) + }) + }) + + Context("With a failing synchronized before suite", func() { + BeforeEach(func() { + pathToTest = tmpPath("suite_setup") + copyIn(fixturePath("exiting_synchronized_setup_tests"), pathToTest, false) + }) + + It("should fail and let the user know that node 1 disappeared prematurely", func() { + session := startGinkgo(pathToTest, "--noColor", "--nodes=3") + Eventually(session).Should(gexec.Exit(1)) + output := string(session.Out.Contents()) + + Ω(output).Should(ContainSubstring("Node 1 disappeared before completing BeforeSuite")) + Ω(output).Should(ContainSubstring("Ginkgo timed out waiting for all parallel nodes to report back!")) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/tags_test.go b/vendor/github.com/onsi/ginkgo/integration/tags_test.go new file mode 100644 index 000000000..fc2ff5e5c --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/tags_test.go @@ -0,0 +1,27 @@ +package integration_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Tags", func() { + var pathToTest string + BeforeEach(func() { + pathToTest = tmpPath("tags") + copyIn(fixturePath("tags_tests"), pathToTest, false) + }) + + It("should honor the passed in -tags flag", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := string(session.Out.Contents()) + Ω(output).Should(ContainSubstring("Ran 1 of 1 Specs")) + + session = startGinkgo(pathToTest, "--noColor", "-tags=complex_tests") + Eventually(session).Should(gexec.Exit(0)) + output = string(session.Out.Contents()) + Ω(output).Should(ContainSubstring("Ran 3 of 3 Specs")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/test_description_test.go b/vendor/github.com/onsi/ginkgo/integration/test_description_test.go new file mode 100644 index 000000000..6739871fb --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/test_description_test.go @@ -0,0 +1,25 @@ +package integration_test + +import ( + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("TestDescription", func() { + var pathToTest string + + BeforeEach(func() { + pathToTest = tmpPath("test_description") + copyIn(fixturePath("test_description"), pathToTest, false) + }) + + It("should capture and emit information about the current test", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(1)) + + Ω(session).Should(gbytes.Say("TestDescription should pass:false")) + Ω(session).Should(gbytes.Say("TestDescription should fail:true")) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/verbose_and_succinct_test.go b/vendor/github.com/onsi/ginkgo/integration/verbose_and_succinct_test.go new file mode 100644 index 000000000..8238762d1 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/verbose_and_succinct_test.go @@ -0,0 +1,90 @@ +package integration_test + +import ( + "regexp" + "runtime" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Verbose And Succinct Mode", func() { + var pathToTest string + var otherPathToTest string + + isWindows := (runtime.GOOS == "windows") + denoter := "•" + + if isWindows { + denoter = "+" + } + + Context("when running one package", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + }) + + It("should default to non-succinct mode", func() { + session := startGinkgo(pathToTest, "--noColor") + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + }) + }) + + Context("when running more than one package", func() { + BeforeEach(func() { + pathToTest = tmpPath("ginkgo") + copyIn(fixturePath("passing_ginkgo_tests"), pathToTest, false) + otherPathToTest = tmpPath("more_ginkgo") + copyIn(fixturePath("more_ginkgo_tests"), otherPathToTest, false) + }) + + Context("with no flags set", func() { + It("should default to succinct mode", func() { + session := startGinkgo(pathToTest, "--noColor", pathToTest, otherPathToTest) + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(MatchRegexp(`\] Passing_ginkgo_tests Suite - 4/4 specs [%s]{4} SUCCESS!`, regexp.QuoteMeta(denoter))) + Ω(output).Should(MatchRegexp(`\] More_ginkgo_tests Suite - 2/2 specs [%s]{2} SUCCESS!`, regexp.QuoteMeta(denoter))) + }) + }) + + Context("with --succinct=false", func() { + It("should not be in succinct mode", func() { + session := startGinkgo(pathToTest, "--noColor", "--succinct=false", pathToTest, otherPathToTest) + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite")) + }) + }) + + Context("with -v", func() { + It("should not be in succinct mode, but should be verbose", func() { + session := startGinkgo(pathToTest, "--noColor", "-v", pathToTest, otherPathToTest) + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite")) + Ω(output).Should(ContainSubstring("should proxy strings")) + Ω(output).Should(ContainSubstring("should always pass")) + }) + + It("should emit output from Bys", func() { + session := startGinkgo(pathToTest, "--noColor", "-v", pathToTest) + Eventually(session).Should(gexec.Exit(0)) + output := session.Out.Contents() + + Ω(output).Should(ContainSubstring("emitting one By")) + Ω(output).Should(ContainSubstring("emitting another By")) + }) + }) + }) +}) diff --git a/vendor/github.com/onsi/ginkgo/integration/watch_test.go b/vendor/github.com/onsi/ginkgo/integration/watch_test.go new file mode 100644 index 000000000..1d65702a7 --- /dev/null +++ b/vendor/github.com/onsi/ginkgo/integration/watch_test.go @@ -0,0 +1,275 @@ +package integration_test + +import ( + "io/ioutil" + "os" + "path/filepath" + "time" + + . "github.com/onsi/ginkgo" + . "github.com/onsi/gomega" + "github.com/onsi/gomega/gbytes" + "github.com/onsi/gomega/gexec" +) + +var _ = Describe("Watch", func() { + var rootPath string + var pathA string + var pathB string + var pathC string + var session *gexec.Session + + BeforeEach(func() { + rootPath = tmpPath("root") + pathA = filepath.Join(rootPath, "src", "github.com", "onsi", "A") + pathB = filepath.Join(rootPath, "src", "github.com", "onsi", "B") + pathC = filepath.Join(rootPath, "src", "github.com", "onsi", "C") + + err := os.MkdirAll(pathA, 0700) + Ω(err).ShouldNot(HaveOccurred()) + + err = os.MkdirAll(pathB, 0700) + Ω(err).ShouldNot(HaveOccurred()) + + err = os.MkdirAll(pathC, 0700) + Ω(err).ShouldNot(HaveOccurred()) + + copyIn(fixturePath(filepath.Join("watch_fixtures", "A")), pathA, false) + copyIn(fixturePath(filepath.Join("watch_fixtures", "B")), pathB, false) + copyIn(fixturePath(filepath.Join("watch_fixtures", "C")), pathC, false) + }) + + startGinkgoWithGopath := func(args ...string) *gexec.Session { + cmd := ginkgoCommand(rootPath, args...) + os.Setenv("GOPATH", rootPath+":"+os.Getenv("GOPATH")) + session, err := gexec.Start(cmd, GinkgoWriter, GinkgoWriter) + Ω(err).ShouldNot(HaveOccurred()) + return session + } + + modifyFile := func(path string) { + time.Sleep(time.Second) + content, err := ioutil.ReadFile(path) + Ω(err).ShouldNot(HaveOccurred()) + content = append(content, []byte("//")...) + err = ioutil.WriteFile(path, content, 0666) + Ω(err).ShouldNot(HaveOccurred()) + } + + modifyCode := func(pkgToModify string) { + modifyFile(filepath.Join(rootPath, "src", "github.com", "onsi", pkgToModify, pkgToModify+".go")) + } + + modifyJSON := func(pkgToModify string) { + modifyFile(filepath.Join(rootPath, "src", "github.com", "onsi", pkgToModify, pkgToModify+".json")) + } + + modifyTest := func(pkgToModify string) { + modifyFile(filepath.Join(rootPath, "src", "github.com", "onsi", pkgToModify, pkgToModify+"_test.go")) + } + + AfterEach(func() { + if session != nil { + session.Kill().Wait() + } + }) + + It("should be set up correctly", func() { + session = startGinkgoWithGopath("-r") + Eventually(session).Should(gexec.Exit(0)) + Ω(session.Out.Contents()).Should(ContainSubstring("A Suite")) + Ω(session.Out.Contents()).Should(ContainSubstring("B Suite")) + Ω(session.Out.Contents()).Should(ContainSubstring("C Suite")) + Ω(session.Out.Contents()).Should(ContainSubstring("Ginkgo ran 3 suites")) + }) + + Context("when watching just one test suite", func() { + It("should immediately run, and should rerun when the test suite changes", func() { + session = startGinkgoWithGopath("watch", "-succinct", pathA) + Eventually(session).Should(gbytes.Say("A Suite")) + modifyCode("A") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("A Suite")) + session.Kill().Wait() + }) + }) + + Context("when watching several test suites", func() { + It("should not immediately run, but should rerun a test when its code changes", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r") + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Consistently(session).ShouldNot(gbytes.Say("A Suite|B Suite|C Suite")) + modifyCode("A") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("B Suite|C Suite")) + session.Kill().Wait() + }) + }) + + Describe("watching dependencies", func() { + Context("with a depth of 2", func() { + It("should watch down to that depth", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r", "-depth=2") + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Eventually(session).Should(gbytes.Say(`A \[2 dependencies\]`)) + Eventually(session).Should(gbytes.Say(`B \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say(`C \[0 dependencies\]`)) + + modifyCode("A") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("B Suite|C Suite")) + + modifyCode("B") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("B Suite")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("C Suite")) + + modifyCode("C") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("C Suite")) + Eventually(session).Should(gbytes.Say("B Suite")) + Eventually(session).Should(gbytes.Say("A Suite")) + }) + }) + + Context("with a depth of 1", func() { + It("should watch down to that depth", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r", "-depth=1") + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Eventually(session).Should(gbytes.Say(`A \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say(`B \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say(`C \[0 dependencies\]`)) + + modifyCode("A") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("B Suite|C Suite")) + + modifyCode("B") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("B Suite")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("C Suite")) + + modifyCode("C") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("C Suite")) + Eventually(session).Should(gbytes.Say("B Suite")) + Consistently(session).ShouldNot(gbytes.Say("A Suite")) + }) + }) + + Context("with a depth of 0", func() { + It("should not watch any dependencies", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r", "-depth=0") + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Eventually(session).Should(gbytes.Say(`A \[0 dependencies\]`)) + Eventually(session).Should(gbytes.Say(`B \[0 dependencies\]`)) + Eventually(session).Should(gbytes.Say(`C \[0 dependencies\]`)) + + modifyCode("A") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("B Suite|C Suite")) + + modifyCode("B") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("B Suite")) + Consistently(session).ShouldNot(gbytes.Say("A Suite|C Suite")) + + modifyCode("C") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("C Suite")) + Consistently(session).ShouldNot(gbytes.Say("A Suite|B Suite")) + }) + }) + + It("should not trigger dependents when tests are changed", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r", "-depth=2") + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Eventually(session).Should(gbytes.Say(`A \[2 dependencies\]`)) + Eventually(session).Should(gbytes.Say(`B \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say(`C \[0 dependencies\]`)) + + modifyTest("A") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("A Suite")) + Consistently(session).ShouldNot(gbytes.Say("B Suite|C Suite")) + + modifyTest("B") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("B Suite")) + Consistently(session).ShouldNot(gbytes.Say("A Suite|C Suite")) + + modifyTest("C") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("C Suite")) + Consistently(session).ShouldNot(gbytes.Say("A Suite|B Suite")) + }) + }) + + Describe("adjusting the watch regular expression", func() { + Describe("the default regular expression", func() { + It("should only trigger when go files are changed", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r", "-depth=2") + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Eventually(session).Should(gbytes.Say(`A \[2 dependencies\]`)) + Eventually(session).Should(gbytes.Say(`B \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say(`C \[0 dependencies\]`)) + + modifyJSON("C") + Consistently(session).ShouldNot(gbytes.Say("Detected changes in")) + Consistently(session).ShouldNot(gbytes.Say("A Suite|B Suite|C Suite")) + }) + }) + + Describe("modifying the regular expression", func() { + It("should trigger if the regexp matches", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r", "-depth=2", `-watchRegExp=\.json$`) + Eventually(session).Should(gbytes.Say("Identified 3 test suites")) + Eventually(session).Should(gbytes.Say(`A \[2 dependencies\]`)) + Eventually(session).Should(gbytes.Say(`B \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say(`C \[0 dependencies\]`)) + + modifyJSON("C") + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("C Suite")) + Eventually(session).Should(gbytes.Say("B Suite")) + Eventually(session).Should(gbytes.Say("A Suite")) + }) + }) + }) + + Describe("when new test suite is added", func() { + It("should start monitoring that test suite", func() { + session = startGinkgoWithGopath("watch", "-succinct", "-r") + + Eventually(session).Should(gbytes.Say("Watching 3 suites")) + + pathD := filepath.Join(rootPath, "src", "github.com", "onsi", "D") + + err := os.MkdirAll(pathD, 0700) + Ω(err).ShouldNot(HaveOccurred()) + + copyIn(fixturePath(filepath.Join("watch_fixtures", "D")), pathD, false) + + Eventually(session).Should(gbytes.Say("Detected 1 new suite")) + Eventually(session).Should(gbytes.Say(`D \[1 dependency\]`)) + Eventually(session).Should(gbytes.Say("D Suite")) + + modifyCode("D") + + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("D Suite")) + + modifyCode("C") + + Eventually(session).Should(gbytes.Say("Detected changes in")) + Eventually(session).Should(gbytes.Say("C Suite")) + Eventually(session).Should(gbytes.Say("D Suite")) + }) + }) +}) |