github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/global/global_suite_test.go (about)

     1  package global
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  
     7  	"code.cloudfoundry.org/cli/integration/helpers"
     8  
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/gomega"
    11  
    12  	"testing"
    13  )
    14  
    15  const (
    16  	CFEventuallyTimeout   = 300 * time.Second
    17  	CFConsistentlyTimeout = 500 * time.Millisecond
    18  )
    19  
    20  var (
    21  	// Per Test Level
    22  	homeDir       string
    23  	ReadOnlyOrg   string
    24  	ReadOnlySpace string
    25  )
    26  
    27  func TestGlobal(t *testing.T) {
    28  	RegisterFailHandler(Fail)
    29  	RunSpecs(t, "Global Suite")
    30  }
    31  
    32  var _ = SynchronizedBeforeSuite(func() []byte {
    33  	GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each=============================="))
    34  	// Ginkgo Globals
    35  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    36  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    37  
    38  	// Setup common environment variables
    39  	helpers.TurnOffColors()
    40  
    41  	helpers.SetupSynchronizedSuite(func() {
    42  		helpers.EnableFeatureFlag("diego_docker")
    43  		helpers.EnableFeatureFlag("service_instance_sharing")
    44  	})
    45  
    46  	ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace()
    47  
    48  	GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each=============================="))
    49  	return nil
    50  }, func(_ []byte) {
    51  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    52  	if GinkgoParallelNode() != 1 {
    53  		Fail("Test suite cannot run in parallel")
    54  	}
    55  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    56  })
    57  
    58  var _ = BeforeEach(func() {
    59  	GinkgoWriter.Write([]byte("==============================Global Before Each=============================="))
    60  	homeDir = helpers.SetHomeDir()
    61  	helpers.SetAPI()
    62  	GinkgoWriter.Write([]byte("==============================End of Global Before Each=============================="))
    63  })
    64  
    65  var _ = AfterEach(func() {
    66  	GinkgoWriter.Write([]byte("==============================Global After Each=============================="))
    67  	helpers.DestroyHomeDir(homeDir)
    68  	GinkgoWriter.Write([]byte("==============================End of Global After Each=============================="))
    69  })