github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/integration/global/global_suite_test.go (about)

     1  package global
     2  
     3  import (
     4  	"time"
     5  
     6  	"code.cloudfoundry.org/cli/integration/helpers"
     7  
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  
    11  	"testing"
    12  )
    13  
    14  const (
    15  	CFEventuallyTimeout   = 30 * time.Second
    16  	CFConsistentlyTimeout = 500 * time.Millisecond
    17  )
    18  
    19  var (
    20  	// Per Test Level
    21  	homeDir string
    22  )
    23  
    24  func TestGlobal(t *testing.T) {
    25  	RegisterFailHandler(Fail)
    26  	RunSpecs(t, "Global Suite")
    27  }
    28  
    29  var _ = SynchronizedBeforeSuite(func() []byte {
    30  	// Ginkgo Globals
    31  	SetDefaultEventuallyTimeout(CFEventuallyTimeout)
    32  	SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
    33  
    34  	// Setup common environment variables
    35  	helpers.TurnOffColors()
    36  	return nil
    37  }, func(_ []byte) {
    38  	if GinkgoParallelNode() != 1 {
    39  		Fail("Test suite cannot run in parallel")
    40  	}
    41  })
    42  
    43  var _ = BeforeEach(func() {
    44  	homeDir = helpers.SetHomeDir()
    45  	helpers.SetAPI()
    46  })
    47  
    48  var _ = AfterEach(func() {
    49  	helpers.DestroyHomeDir(homeDir)
    50  })
    51  
    52  func setupCF(org string, space string) {
    53  	helpers.LoginCF()
    54  	helpers.CreateOrgAndSpace(org, space)
    55  	helpers.TargetOrgAndSpace(org, space)
    56  }