github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/integration/v7/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 ) 18 19 var ( 20 // Suite Level 21 apiURL string 22 skipSSLValidation bool 23 ReadOnlyOrg string 24 ReadOnlySpace string 25 26 // Per Test Level 27 homeDir string 28 ) 29 30 func TestExperimental(t *testing.T) { 31 RegisterFailHandler(Fail) 32 RunSpecs(t, "Experimental Integration Suite") 33 } 34 35 var _ = SynchronizedBeforeSuite(func() []byte { 36 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 37 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 38 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 39 40 helpers.SetupSynchronizedSuite(func() { 41 helpers.EnableFeatureFlag("diego_docker") 42 43 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 44 helpers.EnableFeatureFlag("service_instance_sharing") 45 } 46 }) 47 48 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 49 50 return nil 51 }, func(_ []byte) { 52 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 53 // Ginkgo Globals 54 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 55 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 56 57 // Setup common environment variables 58 helpers.TurnOffColors() 59 60 // Enable Experimental Flag 61 helpers.TurnOnExperimental() 62 63 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 64 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 65 }) 66 67 var _ = SynchronizedAfterSuite(func() { 68 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 69 homeDir = helpers.SetHomeDir() 70 helpers.SetAPI() 71 helpers.LoginCF() 72 helpers.QuickDeleteOrg(ReadOnlyOrg) 73 helpers.DestroyHomeDir(homeDir) 74 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 75 }, func() {}) 76 77 var _ = BeforeEach(func() { 78 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 79 homeDir = helpers.SetHomeDir() 80 apiURL, skipSSLValidation = helpers.SetAPI() 81 82 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 83 }) 84 85 var _ = AfterEach(func() { 86 GinkgoWriter.Write([]byte("==============================Global After Each==============================")) 87 helpers.DestroyHomeDir(homeDir) 88 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 89 })