github.com/franc20/ayesa_sap@v7.0.0-beta.28.0.20200124003224-302d4d52fa6c+incompatible/integration/shared/global/global_suite_test.go (about) 1 package global 2 3 import ( 4 "fmt" 5 "time" 6 7 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 8 "code.cloudfoundry.org/cli/integration/helpers" 9 10 . "github.com/onsi/ginkgo" 11 . "github.com/onsi/gomega" 12 13 "testing" 14 ) 15 16 const ( 17 CFEventuallyTimeout = 300 * time.Second 18 CFConsistentlyTimeout = 500 * time.Millisecond 19 ) 20 21 var ( 22 // Per Test Level 23 homeDir string 24 ReadOnlyOrg string 25 ReadOnlySpace string 26 ) 27 28 func TestGlobal(t *testing.T) { 29 RegisterFailHandler(Fail) 30 RunSpecs(t, "Global Suite") 31 } 32 33 var _ = SynchronizedBeforeSuite(func() []byte { 34 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 35 // Ginkgo Globals 36 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 37 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 38 39 // Setup common environment variables 40 helpers.TurnOffColors() 41 42 helpers.SetupSynchronizedSuite(func() { 43 helpers.EnableFeatureFlag("diego_docker") 44 45 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 46 helpers.EnableFeatureFlag("service_instance_sharing") 47 } 48 }) 49 50 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 51 52 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 53 return nil 54 }, func(_ []byte) { 55 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 56 if GinkgoParallelNode() != 1 { 57 Fail("Test suite cannot run in parallel") 58 } 59 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 60 }) 61 62 var _ = BeforeEach(func() { 63 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 64 homeDir = helpers.SetHomeDir() 65 helpers.SetAPI() 66 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 67 }) 68 69 var _ = AfterEach(func() { 70 GinkgoWriter.Write([]byte("==============================Global After Each==============================")) 71 helpers.DestroyHomeDir(homeDir) 72 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 73 })