-
Notifications
You must be signed in to change notification settings - Fork 11
/
up_test.go
46 lines (35 loc) · 1.26 KB
/
up_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"testing"
"github.com/facebookgo/ensure"
"github.com/gliderlabs/hostctl/providers"
)
func TestUpSimple(t *testing.T) {
t.Parallel()
provider := new(providers.TestProvider)
stdout, stderr := testRunCmd(t, "hostctl up test1", 0, provider, nil)
ensure.DeepEqual(t, stderr.String(), "\n")
ensure.DeepEqual(t, stdout.String(), "")
ensure.NotDeepEqual(t, provider.Get("test1"), (*providers.Host)(nil))
}
func TestUpExists(t *testing.T) {
t.Parallel()
provider := new(providers.TestProvider)
provider.Create(providers.Host{
Name: "test1",
})
stdout, stderr := testRunCmd(t, "hostctl up test1", 0, provider, nil)
ensure.DeepEqual(t, stderr.String(), "\n")
ensure.DeepEqual(t, stdout.String(), "")
ensure.NotDeepEqual(t, provider.Get("test1"), (*providers.Host)(nil))
}
func TestUpMultiple(t *testing.T) {
t.Parallel()
provider := new(providers.TestProvider)
stdout, stderr := testRunCmd(t, "hostctl up test1 test2 test3", 0, provider, nil)
ensure.DeepEqual(t, stderr.String(), "\n")
ensure.DeepEqual(t, stdout.String(), "")
ensure.NotDeepEqual(t, provider.Get("test1"), (*providers.Host)(nil))
ensure.NotDeepEqual(t, provider.Get("test2"), (*providers.Host)(nil))
ensure.NotDeepEqual(t, provider.Get("test3"), (*providers.Host)(nil))
}