github.com/randomtask1155/cli@v6.41.1-0.20181227003417-a98eed78cbde+incompatible/integration/shared/experimental/experimental_suite_test.go (about) 1 package experimental 2 3 import ( 4 "fmt" 5 "testing" 6 "time" 7 8 "code.cloudfoundry.org/cli/api/cloudcontroller/ccversion" 9 "code.cloudfoundry.org/cli/integration/helpers" 10 . "github.com/onsi/ginkgo" 11 . "github.com/onsi/gomega" 12 ) 13 14 const ( 15 CFEventuallyTimeout = 300 * time.Second 16 CFConsistentlyTimeout = 500 * time.Millisecond 17 RealIsolationSegment = "persistent_isolation_segment" 18 PublicDockerImage = "cloudfoundry/diego-docker-app-custom" 19 ) 20 21 var ( 22 // Suite Level 23 apiURL string 24 skipSSLValidation string 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 honeyCombReporter := helpers.GetHoneyCombReporter("Experimental Test Suite") 37 38 if honeyCombReporter != nil { 39 reporters = append(reporters, honeyCombReporter) 40 } 41 42 RunSpecsWithDefaultAndCustomReporters(t, "Experimental Integration Suite", reporters) 43 } 44 45 var _ = SynchronizedBeforeSuite(func() []byte { 46 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 47 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 48 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 49 50 helpers.SetupSynchronizedSuite(func() { 51 helpers.EnableFeatureFlag("diego_docker") 52 53 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 54 helpers.EnableFeatureFlag("service_instance_sharing") 55 } 56 }) 57 58 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 59 60 return nil 61 }, func(_ []byte) { 62 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 63 // Ginkgo Globals 64 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 65 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 66 67 // Setup common environment variables 68 helpers.TurnOffColors() 69 70 // Enable Experimental Flag 71 helpers.TurnOnExperimental() 72 73 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 74 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 75 }) 76 77 var _ = SynchronizedAfterSuite(func() { 78 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 79 homeDir = helpers.SetHomeDir() 80 helpers.SetAPI() 81 helpers.LoginCF() 82 helpers.QuickDeleteOrg(ReadOnlyOrg) 83 helpers.DestroyHomeDir(homeDir) 84 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 85 }, func() { 86 }) 87 88 var _ = BeforeEach(func() { 89 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 90 homeDir = helpers.SetHomeDir() 91 apiURL, skipSSLValidation = helpers.SetAPI() 92 93 helpers.SkipIfVersionLessThan(ccversion.MinVersionApplicationFlowV3) 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 })