github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+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/api/cloudcontroller/ccversion"
     9  	"code.cloudfoundry.org/cli/integration/helpers"
    10  	. "github.com/onsi/ginkgo"
    11  	. "github.com/onsi/gomega"
    12  )
    13  
    14  const (
    15  	CFEventuallyTimeout   = 300 * time.Second
    16  	CFConsistentlyTimeout = 500 * time.Millisecond
    17  	PublicDockerImage     = "cloudfoundry/diego-docker-app-custom"
    18  )
    19  
    20  var (
    21  	// Suite Level
    22  	apiURL            string
    23  	skipSSLValidation bool
    24  	ReadOnlyOrg       string
    25  	ReadOnlySpace     string
    26  
    27  	// Per Test Level
    28  	homeDir string
    29  )
    30  
    31  func TestExperimental(t *testing.T) {
    32  	RegisterFailHandler(Fail)
    33  	RunSpecs(t, "Experimental Integration Suite")
    34  }
    35  
    36  var _ = SynchronizedBeforeSuite(func() []byte {
    37  	GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each=============================="))
    38  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    39  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    40  
    41  	helpers.SetupSynchronizedSuite(func() {
    42  		helpers.EnableFeatureFlag("diego_docker")
    43  
    44  		if helpers.IsVersionMet(ccversion.MinVersionShareServiceV3) {
    45  			helpers.EnableFeatureFlag("service_instance_sharing")
    46  		}
    47  	})
    48  
    49  	GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each=============================="))
    50  
    51  	return nil
    52  }, func(_ []byte) {
    53  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    54  	// Ginkgo Globals
    55  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    56  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    57  
    58  	// Setup common environment variables
    59  	helpers.TurnOffColors()
    60  
    61  	// Enable Experimental Flag
    62  	helpers.TurnOnExperimental()
    63  
    64  	ReadOnlyOrg, ReadOnlySpace = helpers.SetupReadOnlyOrgAndSpace()
    65  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    66  })
    67  
    68  var _ = SynchronizedAfterSuite(func() {
    69  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
    70  	homeDir = helpers.SetHomeDir()
    71  	helpers.SetAPI()
    72  	helpers.LoginCF()
    73  	helpers.QuickDeleteOrg(ReadOnlyOrg)
    74  	helpers.DestroyHomeDir(homeDir)
    75  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
    76  }, func() {})
    77  
    78  var _ = BeforeEach(func() {
    79  	GinkgoWriter.Write([]byte("==============================Global Before Each=============================="))
    80  	homeDir = helpers.SetHomeDir()
    81  	apiURL, skipSSLValidation = helpers.SetAPI()
    82  
    83  	GinkgoWriter.Write([]byte("==============================End of Global Before Each=============================="))
    84  })
    85  
    86  var _ = AfterEach(func() {
    87  	GinkgoWriter.Write([]byte("==============================Global After Each=============================="))
    88  	helpers.DestroyHomeDir(homeDir)
    89  	GinkgoWriter.Write([]byte("==============================End of Global After Each=============================="))
    90  })