...

Source file src/github.com/onsi/ginkgo/v2/integration/_fixtures/eventually_failing_fixture/eventually_failing_test.go

Documentation: github.com/onsi/ginkgo/v2/integration/_fixtures/eventually_failing_fixture

     1  package eventually_failing_test
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  	"strings"
     7  	"time"
     8  
     9  	. "github.com/onsi/ginkgo/v2"
    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  })
    30  

View as plain text