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