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