diff --git a/pkg/framework/test/integration/integration_suite_test.go b/pkg/framework/test/integration/integration_suite_test.go index 397d4feee..37dd60fc1 100644 --- a/pkg/framework/test/integration/integration_suite_test.go +++ b/pkg/framework/test/integration/integration_suite_test.go @@ -6,6 +6,9 @@ import ( "testing" + "os" + "path/filepath" + "github.com/onsi/gomega/gexec" ) @@ -14,6 +17,19 @@ func TestIntegration(t *testing.T) { RunSpecs(t, "Integration Suite") } +var ( + defaultPathToEtcd string + defaultPathToApiserver string +) + +var _ = BeforeSuite(func() { + assetsDir, ok := os.LookupEnv("KUBE_ASSETS_DIR") + Expect(ok).To(BeTrue(), "Expected $KUBE_ASSETS_DIR to be set") + + defaultPathToEtcd = filepath.Join(assetsDir, "etcd") + defaultPathToApiserver = filepath.Join(assetsDir, "kube-apiserver") +}) + var _ = AfterSuite(func() { gexec.TerminateAndWait() }) diff --git a/pkg/framework/test/integration/integration_test.go b/pkg/framework/test/integration/integration_test.go index 199f623d1..189da0442 100644 --- a/pkg/framework/test/integration/integration_test.go +++ b/pkg/framework/test/integration/integration_test.go @@ -3,8 +3,6 @@ package integration_test import ( "fmt" "net" - "os" - "path/filepath" "time" . "github.com/onsi/ginkgo" @@ -14,13 +12,7 @@ import ( var _ = Describe("Integration", func() { It("Successfully manages the fixtures lifecycle", func() { - assetsDir, ok := os.LookupEnv("KUBE_ASSETS_DIR") - Expect(ok).To(BeTrue(), "Expected $KUBE_ASSETS_DIR to be set") - - pathToEtcd := filepath.Join(assetsDir, "etcd") - pathToApiserver := filepath.Join(assetsDir, "kube-apiserver") - - fixtures := test.NewFixtures(pathToEtcd, pathToApiserver) + fixtures := test.NewFixtures(defaultPathToEtcd, defaultPathToApiserver) err := fixtures.Start() Expect(err).NotTo(HaveOccurred(), "Expected fixtures to start successfully") @@ -40,6 +32,15 @@ var _ = Describe("Integration", func() { By("Ensuring APIServer is not listening anymore") Expect(isAPIServerListening()).To(BeFalse(), "Expected APIServer not to listen anymore") }) + + Measure("It should be fast to bring up and tear down the fixtures", func(b Benchmarker) { + b.Time("lifecycle", func() { + fixtures := test.NewFixtures(defaultPathToEtcd, defaultPathToApiserver) + + fixtures.Start() + fixtures.Stop() + }) + }, 10) }) type portChecker func() bool