github.com/wanddynosios/cli@v7.1.0+incompatible/integration/v6/experimental/experimental_suite_test.go (about)

     1  package experimental
     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  	PublicDockerImage     = "cloudfoundry/diego-docker-app-custom"
    17  )
    18  
    19  var (
    20  	// Suite Level
    21  	apiURL            string
    22  	skipSSLValidation bool
    23  	ReadOnlyOrg       string
    24  	ReadOnlySpace     string
    25  
    26  	// Per Test Level
    27  	homeDir string
    28  )
    29  
    30  func TestExperimental(t *testing.T) {
    31  	RegisterFailHandler(Fail)
    32  	RunSpecs(t, "Experimental Integration Suite")
    33  }
    34  
    35  var _ = SynchronizedBeforeSuite(func() []byte {
    36  	GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each=============================="))
    37  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    38  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    39  
    40  	helpers.SetupSynchronizedSuite(func() {
    41  		helpers.EnableFeatureFlag("diego_docker")
    42  		helpers.EnableFeatureFlag("service_instance_sharing")
    43  	})
    44  
    45  	GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each=============================="))
    46  
    47  	return nil
    48  }, func(_ []byte) {
    49  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    50  	// Ginkgo Globals
    51  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    52  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    53  
    54  	// Setup common environment variables
    55  	helpers.TurnOffColors()
    56  
    57  	// Enable Experimental Flag
    58  	helpers.TurnOnExperimental()
    59  
    60  	ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace()
    61  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    62  })
    63  
    64  var _ = SynchronizedAfterSuite(func() {
    65  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
    66  	homeDir = helpers.SetHomeDir()
    67  	helpers.SetAPI()
    68  	helpers.LoginCF()
    69  	helpers.QuickDeleteOrg(ReadOnlyOrg)
    70  	helpers.DestroyHomeDir(homeDir)
    71  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
    72  }, func() {})
    73  
    74  var _ = BeforeEach(func() {
    75  	GinkgoWriter.Write([]byte("==============================Global Before Each=============================="))
    76  	homeDir = helpers.SetHomeDir()
    77  	apiURL, skipSSLValidation = helpers.SetAPI()
    78  
    79  	GinkgoWriter.Write([]byte("==============================End of Global Before Each=============================="))
    80  })
    81  
    82  var _ = AfterEach(func() {
    83  	GinkgoWriter.Write([]byte("==============================Global After Each=============================="))
    84  	helpers.DestroyHomeDir(homeDir)
    85  	GinkgoWriter.Write([]byte("==============================End of Global After Each=============================="))
    86  })