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