| 1 | package progress_report_fixture_test |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "os" |
| 6 | "time" |
| 7 | |
| 8 | . "github.com/onsi/ginkgo/v2" |
| 9 | ) |
| 10 | |
| 11 | var _ = Describe("ProgressReport", func() { |
| 12 | BeforeEach(func() { |
| 13 | DeferCleanup(AttachProgressReporter(func() string { |
| 14 | return fmt.Sprintf("Some global information: %d", GinkgoParallelProcess()) |
| 15 | })) |
| 16 | }) |
| 17 | It("can track on demand", func() { |
| 18 | By("Step A") |
| 19 | By("Step B") |
| 20 | for i := 1; i <= 12; i++ { |
| 21 | GinkgoWriter.Printf("ginkgo-writer-output-%d\n", i) |
| 22 | } |
| 23 | fmt.Printf("READY %d\n", os.Getpid()) |
| 24 | time.Sleep(time.Second) |
| 25 | }) |
| 26 | |
| 27 | It("--poll-progress-after tracks things that take too long", Label("parallel"), func() { |
| 28 | time.Sleep(2 * time.Second) |
| 29 | }) |
| 30 | |
| 31 | It("decorator tracks things that take too long", Label("parallel", "one-second"), func() { |
| 32 | time.Sleep(1 * time.Second) |
| 33 | }, PollProgressAfter(500*time.Millisecond)) |
| 34 | }) |