github.com/jenspinney/cli@v6.42.1-0.20190207184520-7450c600020e+incompatible/integration/shared/isolated/isolated_suite_test.go (about) 1 package isolated 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 DockerImage = "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 TestIsolated(t *testing.T) { 33 RegisterFailHandler(Fail) 34 35 RunSpecs(t, "Isolated Integration Suite") 36 } 37 38 var _ = SynchronizedBeforeSuite(func() []byte { 39 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 40 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 41 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 42 43 helpers.SetupSynchronizedSuite(func() { 44 helpers.EnableFeatureFlag("diego_docker") 45 46 if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) { 47 helpers.EnableFeatureFlag("service_instance_sharing") 48 } 49 }) 50 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 51 52 return nil 53 }, func(_ []byte) { 54 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 55 // Ginkgo Globals 56 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 57 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 58 59 // Setup common environment variables 60 helpers.TurnOffColors() 61 62 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 63 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 64 }) 65 66 var _ = SynchronizedAfterSuite(func() { 67 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 68 homeDir = helpers.SetHomeDir() 69 helpers.SetAPI() 70 helpers.LoginCF() 71 helpers.QuickDeleteOrg(ReadOnlyOrg) 72 helpers.DestroyHomeDir(homeDir) 73 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 74 }, func() { 75 }) 76 77 var _ = BeforeEach(func() { 78 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 79 homeDir = helpers.SetHomeDir() 80 apiURL, skipSSLValidation = helpers.SetAPI() 81 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 82 }) 83 84 var _ = AfterEach(func() { 85 GinkgoWriter.Write([]byte("==============================Global After Each==============================\n")) 86 helpers.DestroyHomeDir(homeDir) 87 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 88 })