github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/v7/experimental/experimental_suite_test.go (about) 1 package experimental 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 ) 19 20 var ( 21 // Suite Level 22 apiURL string 23 skipSSLValidation bool 24 ReadOnlyOrg string 25 ReadOnlySpace string 26 27 // Per Test Level 28 homeDir string 29 ) 30 31 func TestExperimental(t *testing.T) { 32 RegisterFailHandler(Fail) 33 reporters := []Reporter{} 34 35 prBuilderReporter := helpers.GetPRBuilderReporter() 36 if prBuilderReporter != nil { 37 reporters = append(reporters, prBuilderReporter) 38 } 39 RunSpecsWithDefaultAndCustomReporters(t, "Experimental Integration Suite", reporters) 40 } 41 42 var _ = SynchronizedBeforeSuite(func() []byte { 43 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 44 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 45 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 46 47 helpers.SetupSynchronizedSuite(func() { 48 helpers.EnableFeatureFlag("diego_docker") 49 50 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 51 helpers.EnableFeatureFlag("service_instance_sharing") 52 } 53 }) 54 55 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 56 57 return nil 58 }, func(_ []byte) { 59 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 60 // Ginkgo Globals 61 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 62 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 63 64 // Setup common environment variables 65 helpers.TurnOffColors() 66 67 // Enable Experimental Flag 68 helpers.TurnOnExperimental() 69 70 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 71 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 72 }) 73 74 var _ = SynchronizedAfterSuite(func() { 75 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 76 homeDir = helpers.SetHomeDir() 77 helpers.SetAPI() 78 helpers.LoginCF() 79 helpers.QuickDeleteOrg(ReadOnlyOrg) 80 helpers.DestroyHomeDir(homeDir) 81 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 82 }, func() { 83 outputRoot := os.Getenv(helpers.PRBuilderOutputEnvVar) 84 if outputRoot != "" { 85 helpers.WriteFailureSummary(outputRoot, "summary_ise.txt") 86 } 87 }) 88 89 var _ = BeforeEach(func() { 90 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 91 homeDir = helpers.SetHomeDir() 92 apiURL, skipSSLValidation = helpers.SetAPI() 93 94 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 95 }) 96 97 var _ = AfterEach(func() { 98 GinkgoWriter.Write([]byte("==============================Global After Each==============================")) 99 helpers.DestroyHomeDir(homeDir) 100 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 101 })