github.com/nimakaviani/cli@v6.37.1-0.20180619223813-e734901a73fa+incompatible/integration/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 RunSpecs(t, "Experimental 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 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 // Enable Experimental Flag 63 // helpers.TurnOnExperimental() 64 65 ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace() 66 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 67 }) 68 69 var _ = SynchronizedAfterSuite(func() { 70 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 71 homeDir = helpers.SetHomeDir() 72 helpers.SetAPI() 73 helpers.LoginCF() 74 helpers.QuickDeleteOrg(ReadOnlyOrg) 75 helpers.DestroyHomeDir(homeDir) 76 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 77 }, func() { 78 }) 79 80 var _ = BeforeEach(func() { 81 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 82 homeDir = helpers.SetHomeDir() 83 apiURL, skipSSLValidation = helpers.SetAPI() 84 85 helpers.SkipIfVersionLessThan(ccversion.MinVersionV3) 86 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 87 }) 88 89 var _ = AfterEach(func() { 90 GinkgoWriter.Write([]byte("==============================Global After Each==============================")) 91 helpers.DestroyHomeDir(homeDir) 92 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 93 })