Make Fixtures constructor take 0 args

This is a natural consequence of cleaning up after the "APIServer is
responsible for Etcd" refactor.
This commit is contained in:
Hannes Hörl 2017-12-11 12:09:27 +00:00 committed by Gareth Smith
parent fe4e62dc59
commit 1defd3c52e
5 changed files with 5 additions and 39 deletions

View File

@ -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()

View File

@ -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 {

View File

@ -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())
})

View File

@ -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()
})

View File

@ -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()