Skip to content

Commit

Permalink
Explicity enable route_sharing feature on tests that need it (#2331)
Browse files Browse the repository at this point in the history
* Explicity enable route_sharing feature on tests that need it

- previously tests were not stating they needed this feature enable, only a minimum version of capi
- since the feature is not enabled by default, this adds a call to enable it

* Enable route_sharing in common isolated test setup
* Fix formatting

Co-authored-by: Michael Oleske <[email protected]>
Co-authored-by: Alexander Berez <[email protected]>
  • Loading branch information
3 people authored Oct 21, 2022
1 parent 711a346 commit 426fde6
Showing 1 changed file with 62 additions and 61 deletions.
123 changes: 62 additions & 61 deletions integration/helpers/commonisolated/common_isolated_setup.go
Original file line number Diff line number Diff line change
@@ -1,86 +1,87 @@
package commonisolated

import (
"fmt"
"testing"
"time"
"fmt"
"testing"
"time"

"code.cloudfoundry.org/cli/integration/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"code.cloudfoundry.org/cli/integration/helpers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

const (
CFEventuallyTimeout = 300 * time.Second
CFConsistentlyTimeout = 500 * time.Millisecond
RealIsolationSegment = "persistent_isolation_segment"
DockerImage = "cloudfoundry/diego-docker-app-custom"
CFEventuallyTimeout = 300 * time.Second
CFConsistentlyTimeout = 500 * time.Millisecond
RealIsolationSegment = "persistent_isolation_segment"
DockerImage = "cloudfoundry/diego-docker-app-custom"
)

func CommonTestIsolated(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Isolated Integration Suite")
RegisterFailHandler(Fail)
RunSpecs(t, "Isolated Integration Suite")
}

func CommonGinkgoSetup(
// Per suite Level
failureSummaryFilename string,
apiURL *string,
skipSSLValidation *bool,
readOnlyOrg *string,
readOnlySpace *string,
// Per suite Level
failureSummaryFilename string,
apiURL *string,
skipSSLValidation *bool,
readOnlyOrg *string,
readOnlySpace *string,

// Per test level
homeDir *string,
// Per test level
homeDir *string,
) interface{} {
var _ = SynchronizedBeforeSuite(func() []byte {
_, _ = GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each=============================="))
SetDefaultEventuallyTimeout(CFEventuallyTimeout)
SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
var _ = SynchronizedBeforeSuite(func() []byte {
_, _ = GinkgoWriter.Write([]byte("==============================Global FIRST Node Synchronized Before Each=============================="))
SetDefaultEventuallyTimeout(CFEventuallyTimeout)
SetDefaultConsistentlyDuration(CFConsistentlyTimeout)

helpers.SetupSynchronizedSuite(func() {
helpers.EnableFeatureFlag("diego_docker")
helpers.EnableFeatureFlag("service_instance_sharing")
})
helpers.SetupSynchronizedSuite(func() {
helpers.EnableFeatureFlag("diego_docker")
helpers.EnableFeatureFlag("service_instance_sharing")
helpers.EnableFeatureFlag("route_sharing")
})

_, _ = GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each=============================="))
_, _ = GinkgoWriter.Write([]byte("==============================End of Global FIRST Node Synchronized Before Each=============================="))

return nil
}, func(_ []byte) {
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
// Ginkgo Globals
SetDefaultEventuallyTimeout(CFEventuallyTimeout)
SetDefaultConsistentlyDuration(CFConsistentlyTimeout)
return nil
}, func(_ []byte) {
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
// Ginkgo Globals
SetDefaultEventuallyTimeout(CFEventuallyTimeout)
SetDefaultConsistentlyDuration(CFConsistentlyTimeout)

// Setup common environment variables
helpers.TurnOffColors()
// Setup common environment variables
helpers.TurnOffColors()

*readOnlyOrg, *readOnlySpace = helpers.SetupReadOnlyOrgAndSpace()
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
})
*readOnlyOrg, *readOnlySpace = helpers.SetupReadOnlyOrgAndSpace()
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized Before Each==============================", GinkgoParallelNode())))
})

var _ = SynchronizedAfterSuite(func() {
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
*homeDir = helpers.SetHomeDir()
helpers.SetAPI()
helpers.LoginCF()
helpers.QuickDeleteOrg(*readOnlyOrg)
helpers.DestroyHomeDir(*homeDir)
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
}, func() {})
var _ = SynchronizedAfterSuite(func() {
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
*homeDir = helpers.SetHomeDir()
helpers.SetAPI()
helpers.LoginCF()
helpers.QuickDeleteOrg(*readOnlyOrg)
helpers.DestroyHomeDir(*homeDir)
_, _ = GinkgoWriter.Write([]byte(fmt.Sprintf("==============================End of Global Node %d Synchronized After Each==============================", GinkgoParallelNode())))
}, func() {})

var _ = BeforeEach(func() {
_, _ = GinkgoWriter.Write([]byte("==============================Global Before Each=============================="))
*homeDir = helpers.SetHomeDir()
*apiURL, *skipSSLValidation = helpers.SetAPI()
_, _ = GinkgoWriter.Write([]byte("==============================End of Global Before Each=============================="))
})
var _ = BeforeEach(func() {
_, _ = GinkgoWriter.Write([]byte("==============================Global Before Each=============================="))
*homeDir = helpers.SetHomeDir()
*apiURL, *skipSSLValidation = helpers.SetAPI()
_, _ = GinkgoWriter.Write([]byte("==============================End of Global Before Each=============================="))
})

var _ = AfterEach(func() {
_, _ = GinkgoWriter.Write([]byte("==============================Global After Each==============================\n"))
helpers.DestroyHomeDir(*homeDir)
_, _ = GinkgoWriter.Write([]byte("==============================End of Global After Each=============================="))
})
var _ = AfterEach(func() {
_, _ = GinkgoWriter.Write([]byte("==============================Global After Each==============================\n"))
helpers.DestroyHomeDir(*homeDir)
_, _ = GinkgoWriter.Write([]byte("==============================End of Global After Each=============================="))
})

return nil
return nil
}

0 comments on commit 426fde6

Please sign in to comment.