diff --git a/pkg/framework/test/apiserver.go b/pkg/framework/test/apiserver.go index 92dfa0f89..01ed2fd28 100644 --- a/pkg/framework/test/apiserver.go +++ b/pkg/framework/test/apiserver.go @@ -33,34 +33,18 @@ type certDirManager interface { var apiServerBinPathFinder = DefaultBinPathFinder -// NewAPIServer constructs a new APIServer with whatever api_server binary it can find. +// NewAPIServer creates a new APIServer Fixture Process func NewAPIServer(config *APIServerConfig) *APIServer { starter := func(command *exec.Cmd, out, err io.Writer) (SimpleSession, error) { return gexec.Start(command, out, err) } return &APIServer{ - Path: apiServerBinPathFinder("kube_apiserver"), + Path: apiServerBinPathFinder("kube-apiserver"), Config: config, ProcessStarter: starter, - CertDirManager: &TempDirManager{}, - } -} - -// NewAPIServerWithBinary creates a new APIServer Fixture Process -func NewAPIServerWithBinary(pathToAPIServer string, config *APIServerConfig) *APIServer { - starter := func(command *exec.Cmd, out, err io.Writer) (SimpleSession, error) { - return gexec.Start(command, out, err) - } - - apiserver := &APIServer{ - Path: pathToAPIServer, - ProcessStarter: starter, CertDirManager: NewTempDirManager(), - Config: config, } - - return apiserver } // Start starts the apiserver, waits for it to come up, and returns an error, if occoured. diff --git a/pkg/framework/test/apiserver_constructor_test.go b/pkg/framework/test/apiserver_constructor_test.go index 7fc9850d2..6654179bd 100644 --- a/pkg/framework/test/apiserver_constructor_test.go +++ b/pkg/framework/test/apiserver_constructor_test.go @@ -20,7 +20,7 @@ var _ = Describe("NewAPIServer", func() { APIServerURL: "some APIServer URL", } apiServerBinPathFinder = func(name string) string { - Expect(name).To(Equal("kube_apiserver")) + Expect(name).To(Equal("kube-apiserver")) return "some api server path" } diff --git a/pkg/framework/test/democli/integration/integration_suite_test.go b/pkg/framework/test/democli/integration/integration_suite_test.go index 070e30ffc..6a7b9174e 100644 --- a/pkg/framework/test/democli/integration/integration_suite_test.go +++ b/pkg/framework/test/democli/integration/integration_suite_test.go @@ -32,19 +32,14 @@ var _ = BeforeSuite(func() { Expect(ok).NotTo(BeFalse()) defaultAssetsDir := filepath.Clean(filepath.Join(filepath.Dir(thisFile), "..", "..", "assets", "bin")) pathToEtcd := filepath.Join(defaultAssetsDir, "etcd") - pathToAPIServer := filepath.Join(defaultAssetsDir, "kube-apiserver") if pathToBin, ok := os.LookupEnv("TEST_ETCD_BIN"); ok { pathToEtcd = pathToBin } - if pathToBin, ok := os.LookupEnv("TEST_APISERVER_BIN"); ok { - pathToAPIServer = pathToBin - } Expect(pathToEtcd).NotTo(BeEmpty(), "Path to etcd cannot be empty, set $TEST_ETCD_BIN") - Expect(pathToAPIServer).NotTo(BeEmpty(), "Path to apiserver cannot be empty, set $TEST_APISERVER_BIN") - fixtures, err = test.NewFixtures(pathToEtcd, pathToAPIServer) + fixtures, err = test.NewFixtures(pathToEtcd) Expect(err).NotTo(HaveOccurred()) err = fixtures.Start() diff --git a/pkg/framework/test/fixtures.go b/pkg/framework/test/fixtures.go index d3dca841b..7d6ac6886 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, pathToAPIServer string) (*Fixtures, error) { +func NewFixtures(pathToEtcd string) (*Fixtures, error) { etcdConfig, err := NewEtcdConfig() if err != nil { return nil, err @@ -48,7 +48,7 @@ func NewFixtures(pathToEtcd, pathToAPIServer string) (*Fixtures, error) { fixtures := &Fixtures{ Etcd: NewEtcdWithBinaryAndConfig(pathToEtcd, etcdConfig), - APIServer: NewAPIServerWithBinary(pathToAPIServer, apiServerConfig), + APIServer: NewAPIServer(apiServerConfig), } fixtures.Config = FixturesConfig{ diff --git a/pkg/framework/test/fixtures_test.go b/pkg/framework/test/fixtures_test.go index 5275432d8..116eb81e4 100644 --- a/pkg/framework/test/fixtures_test.go +++ b/pkg/framework/test/fixtures_test.go @@ -12,10 +12,9 @@ import ( var _ = Describe("Fixtures", func() { It("can construct a properly wired Fixtures struct", func() { - f, err := NewFixtures("path to etcd", "path to apiserver") + f, err := NewFixtures("path to etcd") Expect(err).NotTo(HaveOccurred()) Expect(f.Etcd.(*Etcd).Path).To(Equal("path to etcd")) - Expect(f.APIServer.(*APIServer).Path).To(Equal("path to apiserver")) }) Context("with a properly configured set of Fixtures", func() { diff --git a/pkg/framework/test/integration/integration_suite_test.go b/pkg/framework/test/integration/integration_suite_test.go index 3cacc8efa..bbd0af855 100644 --- a/pkg/framework/test/integration/integration_suite_test.go +++ b/pkg/framework/test/integration/integration_suite_test.go @@ -18,8 +18,7 @@ func TestIntegration(t *testing.T) { } var ( - defaultPathToEtcd string - defaultPathToApiserver string + defaultPathToEtcd string ) var _ = BeforeSuite(func() { @@ -27,17 +26,12 @@ var _ = BeforeSuite(func() { Expect(ok).NotTo(BeFalse()) defaultAssetsDir := filepath.Clean(filepath.Join(filepath.Dir(thisFile), "..", "assets", "bin")) defaultPathToEtcd = filepath.Join(defaultAssetsDir, "etcd") - defaultPathToApiserver = filepath.Join(defaultAssetsDir, "kube-apiserver") if pathToBin, ok := os.LookupEnv("TEST_ETCD_BIN"); ok { defaultPathToEtcd = pathToBin } - if pathToBin, ok := os.LookupEnv("TEST_APISERVER_BIN"); ok { - defaultPathToApiserver = pathToBin - } Expect(defaultPathToEtcd).NotTo(BeEmpty(), "Path to etcd cannot be empty, set $TEST_ETCD_BIN") - Expect(defaultPathToApiserver).NotTo(BeEmpty(), "Path to apiserver cannot be empty, set $TEST_APISERVER_BIN") }) var _ = AfterSuite(func() { diff --git a/pkg/framework/test/integration/integration_test.go b/pkg/framework/test/integration/integration_test.go index e4d1816f0..503320db7 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, defaultPathToApiserver) + fixtures, err = test.NewFixtures(defaultPathToEtcd) Expect(err).NotTo(HaveOccurred()) By("Starting all the fixture processes") @@ -63,7 +63,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, defaultPathToApiserver) + fixtures, err := test.NewFixtures(defaultPathToEtcd) Expect(err).NotTo(HaveOccurred()) fixtures.Start()