提交 2486a8b6 编写于 作者: D dlorenc 提交者: dlorenc

Fix tests.

上级 5b5442be
......@@ -73,8 +73,7 @@ func (*rpcClientFactory) NewClient(storePath, certsDir string) libmachine.API {
return c
}
// Gets a new client depending on the clientType specified
// defaults to the libmachine client
// NewAPIClient gets a new client.
func NewAPIClient() (libmachine.API, error) {
storePath := constants.GetMinipath()
certsDir := constants.MakeMiniPath("certs")
......
......@@ -116,8 +116,7 @@ func TestGetDriver(t *testing.T) {
}
func TestLocalClientNewHost(t *testing.T) {
f := clientFactories[ClientTypeLocal]
c := f.NewClient("", "")
c := (&localClientFactory{}).NewClient("", "")
var tests = []struct {
description string
......@@ -162,42 +161,6 @@ func TestLocalClientNewHost(t *testing.T) {
}
}
func TestNewAPIClient(t *testing.T) {
var tests = []struct {
description string
clientType ClientType
err bool
}{
{
description: "Client type local",
clientType: ClientTypeLocal,
},
{
description: "Client type RPC",
clientType: ClientTypeRPC,
},
{
description: "Incorrect client type",
clientType: -1,
err: true,
},
}
for _, test := range tests {
test := test
t.Run(test.description, func(t *testing.T) {
t.Parallel()
_, err := NewAPIClient(test.clientType)
if err != nil && !test.err {
t.Errorf("Unexpected error: %s", err)
}
if err == nil && test.err {
t.Errorf("No error returned, but expected err")
}
})
}
}
func makeTempDir() string {
tempDir, err := ioutil.TempDir("", "minipath")
if err != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册