github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/integration/v7/push/push_suite_test.go (about)

     1  package push
     2  
     3  import (
     4  	"fmt"
     5  	"io/ioutil"
     6  	"os"
     7  	"testing"
     8  	"time"
     9  
    10  	"code.cloudfoundry.org/cli/integration/helpers"
    11  	. "github.com/onsi/ginkgo"
    12  	. "github.com/onsi/gomega"
    13  )
    14  
    15  const (
    16  	CFEventuallyTimeout   = 300 * time.Second
    17  	CFConsistentlyTimeout = 500 * time.Millisecond
    18  	PushCommandName       = "push"
    19  	PublicDockerImage     = "cloudfoundry/diego-docker-app-custom"
    20  )
    21  
    22  var (
    23  	// Suite Level
    24  	organization string
    25  	space        string
    26  	realDir      string
    27  
    28  	// Per Test Level
    29  	homeDir string
    30  )
    31  
    32  func TestPush(t *testing.T) {
    33  	RegisterFailHandler(Fail)
    34  	RunSpecs(t, "Push Integration Suite")
    35  }
    36  
    37  var _ = SynchronizedBeforeSuite(func() []byte {
    38  	GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each=============================="))
    39  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    40  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    41  
    42  	helpers.SetupSynchronizedSuite(func() {
    43  		helpers.EnableFeatureFlag("diego_docker")
    44  		helpers.EnableFeatureFlag("service_instance_sharing")
    45  	})
    46  
    47  	GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each=============================="))
    48  
    49  	return nil
    50  }, func(_ []byte) {
    51  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    52  	// Ginkgo Globals
    53  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    54  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    55  
    56  	// Setup common environment variables
    57  	helpers.TurnOffColors()
    58  
    59  	homeDir = helpers.SetHomeDir()
    60  	helpers.SetAPI()
    61  	helpers.LoginCF()
    62  
    63  	organization = helpers.NewOrgName()
    64  	helpers.CreateOrg(organization)
    65  	helpers.TargetOrg(organization)
    66  	helpers.CreateSpace("empty-space")
    67  	helpers.DestroyHomeDir(homeDir)
    68  
    69  	var err error
    70  	realDir, err = ioutil.TempDir("", "push-real-dir")
    71  	Expect(err).ToNot(HaveOccurred())
    72  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
    73  })
    74  
    75  var _ = SynchronizedAfterSuite(func() {
    76  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
    77  	homeDir = helpers.SetHomeDir()
    78  	helpers.SetAPI()
    79  	helpers.LoginCF()
    80  	helpers.QuickDeleteOrg(organization)
    81  	Expect(os.RemoveAll(realDir)).ToNot(HaveOccurred())
    82  	helpers.DestroyHomeDir(homeDir)
    83  	GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
    84  }, func() {
    85  })
    86  
    87  var _ = BeforeEach(func() {
    88  	GinkgoWriter.Write([]byte("==============================Global Before Each=============================="))
    89  	homeDir = helpers.SetHomeDir()
    90  	helpers.SetAPI()
    91  	space = helpers.NewSpaceName()
    92  	helpers.SetupCF(organization, space)
    93  	GinkgoWriter.Write([]byte("==============================End of Global Before Each=============================="))
    94  })
    95  
    96  var _ = AfterEach(func() {
    97  	GinkgoWriter.Write([]byte("==============================Global After Each=============================="))
    98  	helpers.SetAPI()
    99  	helpers.SetupCF(organization, space)
   100  	helpers.QuickDeleteSpace(space)
   101  	helpers.DestroyHomeDir(homeDir)
   102  })