github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/shared/isolated/isolated_suite_test.go (about) 1 package isolated 2 3 import ( 4 "fmt" 5 "os" 6 "testing" 7 "time" 8 9 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 10 "code.cloudfoundry.org/cli/integration/helpers" 11 . "github.com/onsi/ginkgo" 12 . "github.com/onsi/gomega" 13 ) 14 15 const ( 16 CFEventuallyTimeout = 300 * time.Second 17 CFConsistentlyTimeout = 500 * time.Millisecond 18 RealIsolationSegment = "persistent_isolation_segment" 19 ) 20 21 var ( 22 // Suite Level 23 apiURL string 24 skipSSLValidation bool 25 ReadOnlyOrg string 26 ReadOnlySpace string 27 28 // Per Test Level 29 homeDir string 30 ) 31 32 func TestIsolated(t *testing.T) { 33 RegisterFailHandler(Fail) 34 reporters := []Reporter{} 35 36 prBuilderReporter := helpers.GetPRBuilderReporter() 37 if prBuilderReporter != nil { 38 reporters = append(reporters, prBuilderReporter) 39 } 40 41 RunSpecsWithDefaultAndCustomReporters(t, "Isolated Integration Suite", reporters) 42 } 43 44 var _ = SynchronizedBeforeSuite(func() []byte { 45 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 46 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 47 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 48 49 helpers.SetupSynchronizedSuite(func() { 50 helpers.EnableFeatureFlag("diego_docker") 51 52 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 53 helpers.EnableFeatureFlag("service_instance_sharing") 54 } 55 }) 56 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 57 58 return nil 59 }, func(_ []byte) { 60 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 61 // Ginkgo Globals 62 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 63 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 64 65 // Setup common environment variables 66 helpers.TurnOffColors() 67 68 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 69 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 70 }) 71 72 var _ = SynchronizedAfterSuite(func() { 73 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 74 homeDir = helpers.SetHomeDir() 75 helpers.SetAPI() 76 helpers.LoginCF() 77 helpers.QuickDeleteOrg(ReadOnlyOrg) 78 helpers.DestroyHomeDir(homeDir) 79 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 80 }, func() { 81 outputRoot := os.Getenv(helpers.PRBuilderOutputEnvVar) 82 if outputRoot != "" { 83 helpers.WriteFailureSummary(outputRoot, "summary_isi.txt") 84 } 85 }) 86 87 var _ = BeforeEach(func() { 88 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 89 homeDir = helpers.SetHomeDir() 90 apiURL, skipSSLValidation = helpers.SetAPI() 91 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 92 }) 93 94 var _ = AfterEach(func() { 95 GinkgoWriter.Write([]byte("==============================Global After Each==============================\n")) 96 helpers.DestroyHomeDir(homeDir) 97 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 98 })