Debian Codegraph @

integration/_fixtures/synchronized_setup_tests_fixture/synchronized_setup_tests_suite_test.go

raw
1 package synchronized_setup_tests_test
2
3 import (
4 . "github.com/onsi/ginkgo/v2"
5 . "github.com/onsi/gomega"
6
7 "fmt"
8 "testing"
9 "time"
10 )
11
12 func TestSynchronized_setup_tests(t *testing.T) {
13 RegisterFailHandler(Fail)
14 RunSpecs(t, "Synchronized_setup_tests Suite")
15 }
16
17 var beforeData string
18
19 var _ = SynchronizedBeforeSuite(func() []byte {
20 fmt.Printf("BEFORE_A_%d\n", GinkgoParallelProcess())
21 time.Sleep(100 * time.Millisecond)
22 return []byte("DATA")
23 }, func(data []byte) {
24 fmt.Printf("BEFORE_B_%d: %s\n", GinkgoParallelProcess(), string(data))
25 beforeData += string(data) + "OTHER"
26 })
27
28 var _ = SynchronizedAfterSuite(func() {
29 fmt.Printf("\nAFTER_A_%d\n", GinkgoParallelProcess())
30 time.Sleep(100 * time.Millisecond)
31 }, func() {
32 fmt.Printf("AFTER_B_%d\n", GinkgoParallelProcess())
33 })
34
35 var _ = Describe("Synchronized Setup", func() {
36 It("should run the before suite once", func() {
37 Ω(beforeData).Should(Equal("DATAOTHER"))
38 })
39
40 It("should run the before suite once", func() {
41 Ω(beforeData).Should(Equal("DATAOTHER"))
42 })
43 })