kubectl/pkg/framework/test/apiserver_constructor_test.go

37 lines
960 B
Go

package test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("NewAPIServer", func() {
var oldAPIServerBinPathFinder BinPathFinder
BeforeEach(func() {
oldAPIServerBinPathFinder = apiServerBinPathFinder
})
AfterEach(func() {
apiServerBinPathFinder = oldAPIServerBinPathFinder
})
It("can construct a properly configured APIServer", func() {
config := &APIServerConfig{
APIServerURL: "some APIServer URL",
}
apiServerBinPathFinder = func(name string) string {
Expect(name).To(Equal("kube-apiserver"))
return "some api server path"
}
apiServer, err := NewAPIServer(config)
Expect(err).NotTo(HaveOccurred())
Expect(apiServer).NotTo(BeNil())
Expect(apiServer.ProcessStarter).NotTo(BeNil())
Expect(apiServer.CertDirManager).NotTo(BeNil())
Expect(apiServer.Path).To(Equal("some api server path"))
Expect(apiServer.Etcd).NotTo(BeNil())
Expect(apiServer.Config).To(Equal(config))
})
})