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:
parent
fe4e62dc59
commit
1defd3c52e
|
|
@ -4,9 +4,6 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/onsi/gomega/gexec"
|
"github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -28,18 +25,7 @@ var _ = BeforeSuite(func() {
|
||||||
pathToDemoCommand, err = gexec.Build("k8s.io/kubectl/pkg/framework/test/democli/")
|
pathToDemoCommand, err = gexec.Build("k8s.io/kubectl/pkg/framework/test/democli/")
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
_, thisFile, _, ok := runtime.Caller(0)
|
fixtures, err = test.NewFixtures()
|
||||||
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)
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
err = fixtures.Start()
|
err = fixtures.Start()
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ type FixtureProcess interface {
|
||||||
//go:generate counterfeiter . FixtureProcess
|
//go:generate counterfeiter . FixtureProcess
|
||||||
|
|
||||||
// NewFixtures will give you a Fixtures struct that's properly wired together.
|
// NewFixtures will give you a Fixtures struct that's properly wired together.
|
||||||
func NewFixtures(pathToEtcd string) (*Fixtures, error) {
|
func NewFixtures() (*Fixtures, error) {
|
||||||
apiServerConfig := &APIServerConfig{}
|
apiServerConfig := &APIServerConfig{}
|
||||||
|
|
||||||
if url, urlErr := getHTTPListenURL(); urlErr == nil {
|
if url, urlErr := getHTTPListenURL(); urlErr == nil {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import (
|
||||||
|
|
||||||
var _ = Describe("Fixtures", func() {
|
var _ = Describe("Fixtures", func() {
|
||||||
It("can construct a properly wired Fixtures struct", func() {
|
It("can construct a properly wired Fixtures struct", func() {
|
||||||
_, err := NewFixtures("path to etcd")
|
_, err := NewFixtures()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,6 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
"os"
|
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/onsi/gomega/gexec"
|
"github.com/onsi/gomega/gexec"
|
||||||
|
|
@ -17,23 +14,6 @@ func TestIntegration(t *testing.T) {
|
||||||
RunSpecs(t, "Framework Integration Suite")
|
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() {
|
var _ = AfterSuite(func() {
|
||||||
gexec.TerminateAndWait()
|
gexec.TerminateAndWait()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ var _ = Describe("The Testing Framework", func() {
|
||||||
var err error
|
var err error
|
||||||
var fixtures *test.Fixtures
|
var fixtures *test.Fixtures
|
||||||
|
|
||||||
fixtures, err = test.NewFixtures(defaultPathToEtcd)
|
fixtures, err = test.NewFixtures()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
By("Starting all the fixture processes")
|
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) {
|
Measure("It should be fast to bring up and tear down the fixtures", func(b Benchmarker) {
|
||||||
b.Time("lifecycle", func() {
|
b.Time("lifecycle", func() {
|
||||||
fixtures, err := test.NewFixtures(defaultPathToEtcd)
|
fixtures, err := test.NewFixtures()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
|
|
||||||
fixtures.Start()
|
fixtures.Start()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue