github.com/onsi/ginkgo@v1.16.6-0.20211118180735-4e1925ba4c95/integration/_fixtures/eventually_failing_fixture/eventually_failing_test.go (about) 1 package eventually_failing_test 2 3 import ( 4 "fmt" 5 "os" 6 "strings" 7 "time" 8 9 . "github.com/onsi/ginkgo" 10 . "github.com/onsi/gomega" 11 ) 12 13 var _ = Describe("EventuallyFailing", func() { 14 It("should fail on the third try", func() { 15 time.Sleep(time.Second) 16 files, err := os.ReadDir(".") 17 Ω(err).ShouldNot(HaveOccurred()) 18 19 numRuns := 1 20 for _, file := range files { 21 if strings.HasPrefix(file.Name(), "counter") { 22 numRuns++ 23 } 24 } 25 26 Ω(numRuns).Should(BeNumerically("<", 3)) 27 os.WriteFile(fmt.Sprintf("./counter-%d", numRuns), []byte("foo"), 0777) 28 }) 29 })