github.com/cloudfoundry/cli@v7.1.0+incompatible/integration/shared/performance/performance_suite_test.go (about) 1 package performance_test 2 3 import ( 4 "fmt" 5 "testing" 6 "time" 7 8 "code.cloudfoundry.org/cli/integration/helpers" 9 . "github.com/onsi/ginkgo" 10 . "github.com/onsi/gomega" 11 ) 12 13 const ( 14 CFEventuallyTimeout = 300 * time.Second 15 CFConsistentlyTimeout = 500 * time.Millisecond 16 ) 17 18 var ( 19 // Suite Level 20 apiURL string 21 skipSSLValidation bool 22 perfOrg string 23 perfSpace string 24 25 // Per Test Level 26 homeDir string 27 ) 28 29 // TODO: Performance tests should probably run serially and in the same order every time 30 31 func TestPerformance(t *testing.T) { 32 RegisterFailHandler(Fail) 33 RunSpecs(t, "Performance Integration Suite") 34 } 35 36 var _ = SynchronizedBeforeSuite(func() []byte { 37 GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each==============================")) 38 GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each==============================")) 39 40 return nil 41 }, func(_ []byte) { 42 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 43 // Ginkgo Globals 44 SetDefaultEventuallyTimeout(CFEventuallyTimeout) 45 SetDefaultConsistentlyDuration(CFConsistentlyTimeout) 46 47 // Setup common environment variables 48 helpers.TurnOffColors() 49 perfOrg, perfSpace = helpers.SetupReadOnlyOrgAndSpace() 50 51 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode()))) 52 }) 53 54 var _ = SynchronizedAfterSuite(func() { 55 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 56 homeDir = helpers.SetHomeDir() 57 helpers.SetAPI() 58 helpers.LoginCF() 59 helpers.QuickDeleteOrg(perfOrg) 60 helpers.DestroyHomeDir(homeDir) 61 GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode()))) 62 }, func() {}) 63 64 var _ = BeforeEach(func() { 65 GinkgoWriter.Write([]byte("==============================Global Before Each==============================")) 66 homeDir = helpers.SetHomeDir() 67 apiURL, skipSSLValidation = helpers.SetAPI() 68 GinkgoWriter.Write([]byte("==============================End of Global Before Each==============================")) 69 }) 70 71 var _ = AfterEach(func() { 72 GinkgoWriter.Write([]byte("==============================Global After Each==============================\n")) 73 helpers.DestroyHomeDir(homeDir) 74 GinkgoWriter.Write([]byte("==============================End of Global After Each==============================")) 75 })