github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/v6/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 PublicDockerImage = "cloudfoundry/diego-docker-app-custom" 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 TestExperimental(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 RunSpecsWithDefaultAndCustomReporters(t, "Experimental Integration Suite", reporters) 41 } 42 43 var _ = SynchronizedBeforeSuite(func() []byte { 44 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 45 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 46 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 47 48 helpers.SetupSynchronizedSuite(func() { 49 helpers.EnableFeatureFlag("diego_docker") 50 51 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 52 helpers.EnableFeatureFlag("service_instance_sharing") 53 } 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 // Enable Experimental Flag 69 helpers.TurnOnExperimental() 70 71 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 72 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 73 }) 74 75 var _ = SynchronizedAfterSuite(func() { 76 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 77 homeDir = helpers.SetHomeDir() 78 helpers.SetAPI() 79 helpers.LoginCF() 80 helpers.QuickDeleteOrg(ReadOnlyOrg) 81 helpers.DestroyHomeDir(homeDir) 82 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 83 }, func() { 84 outputRoot := os.Getenv(helpers.PRBuilderOutputEnvVar) 85 if outputRoot != "" { 86 helpers.WriteFailureSummary(outputRoot, "summary_ive.txt") 87 } 88 }) 89 90 var _ = BeforeEach(func() { 91 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 92 homeDir = helpers.SetHomeDir() 93 apiURL, skipSSLValidation = helpers.SetAPI() 94 95 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 96 }) 97 98 var _ = AfterEach(func() { 99 GinkgoWriter.Write([]byte("==============================Global After Each==============================")) 100 helpers.DestroyHomeDir(homeDir) 101 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 102 })