Track the time it takes to start&stop the fixtures
This commit is contained in:
parent
eca5aace13
commit
e2a217b37b
|
|
@ -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()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue