github.com/loafoe/cli@v7.1.0+incompatible/integration/v6/push/push_suite_test.go (about) 1 package push 2 3 import ( 4 "fmt" 5 "io/ioutil" 6 "os" 7 "testing" 8 "time" 9 10 "code.cloudfoundry.org/cli/integration/helpers" 11 . "github.com/onsi/ginkgo" 12 . "github.com/onsi/gomega" 13 ) 14 15 const ( 16 CFEventuallyTimeout = 300 * time.Second 17 CFConsistentlyTimeout = 500 * time.Millisecond 18 RealIsolationSegment = "persistent_isolation_segment" 19 PushCommandName = "push" 20 PublicDockerImage = "cloudfoundry/diego-docker-app-custom" 21 ) 22 23 var ( 24 // Suite Level 25 organization string 26 space string 27 realDir string 28 29 // Per Test Level 30 homeDir string 31 ) 32 33 func TestPush(t *testing.T) { 34 RegisterFailHandler(Fail) 35 RunSpecs(t, "Push 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 helpers.EnableFeatureFlag("service_instance_sharing") 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 homeDir = helpers.SetHomeDir() 61 helpers.SetAPI() 62 helpers.LoginCF() 63 64 organization = helpers.NewOrgName() 65 helpers.CreateOrg(organization) 66 helpers.TargetOrg(organization) 67 helpers.CreateSpace("empty-space") 68 helpers.DestroyHomeDir(homeDir) 69 70 var err error 71 realDir, err = ioutil.TempDir("", "push-real-dir") 72 Expect(err).ToNot(HaveOccurred()) 73 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 74 }) 75 76 var _ = SynchronizedAfterSuite(func() { 77 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 78 homeDir = helpers.SetHomeDir() 79 helpers.SetAPI() 80 helpers.LoginCF() 81 helpers.QuickDeleteOrg(organization) 82 Expect(os.RemoveAll(realDir)).ToNot(HaveOccurred()) 83 helpers.DestroyHomeDir(homeDir) 84 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 85 }, func() {}) 86 87 var _ = BeforeEach(func() { 88 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 89 homeDir = helpers.SetHomeDir() 90 helpers.SetAPI() 91 space = helpers.NewSpaceName() 92 helpers.SetupCF(organization, space) 93 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 94 }) 95 96 var _ = AfterEach(func() { 97 GinkgoWriter.Write([]byte("==============================Global After Each==============================")) 98 helpers.SetAPI() 99 helpers.SetupCF(organization, space) 100 helpers.QuickDeleteSpace(space) 101 helpers.DestroyHomeDir(homeDir) 102 })