From 1defd3c52e4e00ea57dca7fdba4b2acea53dd550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20H=C3=B6rl?= Date: Mon, 11 Dec 2017 12:09:27 +0000 Subject: [PATCH] Make Fixtures constructor take 0 args This is a natural consequence of cleaning up after the "APIServer is responsible for Etcd" refactor. --- .../integration/integration_suite_test.go | 16 +-------------- pkg/framework/test/fixtures.go | 2 +- pkg/framework/test/fixtures_test.go | 2 +- .../integration/integration_suite_test.go | 20 ------------------- .../test/integration/integration_test.go | 4 ++-- 5 files changed, 5 insertions(+), 39 deletions(-) diff --git a/pkg/framework/test/democli/integration/integration_suite_test.go b/pkg/framework/test/democli/integration/integration_suite_test.go index 6a7b9174e..b77f0e5ef 100644 --- a/pkg/framework/test/democli/integration/integration_suite_test.go +++ b/pkg/framework/test/democli/integration/integration_suite_test.go @@ -4,9 +4,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "os" - "path/filepath" - "runtime" "testing" "github.com/onsi/gomega/gexec" @@ -28,18 +25,7 @@ var _ = BeforeSuite(func() { pathToDemoCommand, err = gexec.Build("k8s.io/kubectl/pkg/framework/test/democli/") Expect(err).NotTo(HaveOccurred()) - _, thisFile, _, ok := runtime.Caller(0) - Expect(ok).NotTo(BeFalse()) - defaultAssetsDir := filepath.Clean(filepath.Join(filepath.Dir(thisFile), "..", "..", "assets", "bin")) - pathToEtcd := filepath.Join(defaultAssetsDir, "etcd") - - if pathToBin, ok := os.LookupEnv("TEST_ETCD_BIN"); ok { - pathToEtcd = pathToBin - } - - Expect(pathToEtcd).NotTo(BeEmpty(), "Path to etcd cannot be empty, set $TEST_ETCD_BIN") - - fixtures, err = test.NewFixtures(pathToEtcd) + fixtures, err = test.NewFixtures() Expect(err).NotTo(HaveOccurred()) err = fixtures.Start() diff --git a/pkg/framework/test/fixtures.go b/pkg/framework/test/fixtures.go index caa4c9a15..79e31d0d5 100644 --- a/pkg/framework/test/fixtures.go +++ b/pkg/framework/test/fixtures.go @@ -31,7 +31,7 @@ type FixtureProcess interface { //go:generate counterfeiter . FixtureProcess // NewFixtures will give you a Fixtures struct that's properly wired together. -func NewFixtures(pathToEtcd string) (*Fixtures, error) { +func NewFixtures() (*Fixtures, error) { apiServerConfig := &APIServerConfig{} if url, urlErr := getHTTPListenURL(); urlErr == nil { diff --git a/pkg/framework/test/fixtures_test.go b/pkg/framework/test/fixtures_test.go index 2d1329bc9..d76de340f 100644 --- a/pkg/framework/test/fixtures_test.go +++ b/pkg/framework/test/fixtures_test.go @@ -12,7 +12,7 @@ import ( var _ = Describe("Fixtures", func() { It("can construct a properly wired Fixtures struct", func() { - _, err := NewFixtures("path to etcd") + _, err := NewFixtures() Expect(err).NotTo(HaveOccurred()) }) diff --git a/pkg/framework/test/integration/integration_suite_test.go b/pkg/framework/test/integration/integration_suite_test.go index bbd0af855..be53fe58a 100644 --- a/pkg/framework/test/integration/integration_suite_test.go +++ b/pkg/framework/test/integration/integration_suite_test.go @@ -4,9 +4,6 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "os" - "path/filepath" - "runtime" "testing" "github.com/onsi/gomega/gexec" @@ -17,23 +14,6 @@ func TestIntegration(t *testing.T) { RunSpecs(t, "Framework Integration Suite") } -var ( - defaultPathToEtcd string -) - -var _ = BeforeSuite(func() { - _, thisFile, _, ok := runtime.Caller(0) - Expect(ok).NotTo(BeFalse()) - defaultAssetsDir := filepath.Clean(filepath.Join(filepath.Dir(thisFile), "..", "assets", "bin")) - defaultPathToEtcd = filepath.Join(defaultAssetsDir, "etcd") - - if pathToBin, ok := os.LookupEnv("TEST_ETCD_BIN"); ok { - defaultPathToEtcd = pathToBin - } - - Expect(defaultPathToEtcd).NotTo(BeEmpty(), "Path to etcd cannot be empty, set $TEST_ETCD_BIN") -}) - var _ = AfterSuite(func() { gexec.TerminateAndWait() }) diff --git a/pkg/framework/test/integration/integration_test.go b/pkg/framework/test/integration/integration_test.go index 4ae0b9e5a..64c698303 100644 --- a/pkg/framework/test/integration/integration_test.go +++ b/pkg/framework/test/integration/integration_test.go @@ -17,7 +17,7 @@ var _ = Describe("The Testing Framework", func() { var err error var fixtures *test.Fixtures - fixtures, err = test.NewFixtures(defaultPathToEtcd) + fixtures, err = test.NewFixtures() Expect(err).NotTo(HaveOccurred()) By("Starting all the fixture processes") @@ -56,7 +56,7 @@ var _ = Describe("The Testing Framework", func() { Measure("It should be fast to bring up and tear down the fixtures", func(b Benchmarker) { b.Time("lifecycle", func() { - fixtures, err := test.NewFixtures(defaultPathToEtcd) + fixtures, err := test.NewFixtures() Expect(err).NotTo(HaveOccurred()) fixtures.Start()