-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathclusters_test.go
More file actions
59 lines (48 loc) · 1.81 KB
/
clusters_test.go
File metadata and controls
59 lines (48 loc) · 1.81 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
// +build integration
package tests
import (
"testing"
"github.com/deis/deis/tests/utils"
)
var (
clustersCreateCmd = "clusters:create {{.ClusterName}} {{.Domain}} --hosts={{.Hosts}} --auth={{.SSHKey}}"
clustersListCmd = "clusters:list"
clustersUpdateCmd = "clusters:update {{.ClusterName}} --domain={{.Domain}} --hosts={{.Hosts}} --auth=~/.ssh/{{.AuthKey}}"
clustersInfoCmd = "clusters:info {{.ClusterName}}"
clustersDestroyCmd = "clusters:destroy {{.ClusterName}} --confirm={{.ClusterName}}"
)
func TestClusters(t *testing.T) {
params := clustersSetup(t)
clustersCreateTest(t, params)
clustersListTest(t, params, false)
clustersInfoTest(t, params)
clustersUpdateTest(t, params)
clustersDestroyTest(t, params)
clustersListTest(t, params, true)
}
func clustersSetup(t *testing.T) *utils.DeisTestConfig {
cfg := utils.GetGlobalConfig()
cfg.ClusterName = "devtest"
utils.Execute(t, authLoginCmd, cfg, false, "")
return cfg
}
func clustersCreateTest(t *testing.T, params *utils.DeisTestConfig) {
cmd := clustersCreateCmd
utils.Execute(t, cmd, params, false, "")
utils.Execute(t, cmd, params, true, "Cluster with this Id already exists")
}
func clustersDestroyTest(t *testing.T, params *utils.DeisTestConfig) {
utils.Execute(t, clustersDestroyCmd, params, false, "")
}
func clustersInfoTest(t *testing.T, params *utils.DeisTestConfig) {
utils.Execute(t, clustersInfoCmd, params, false, "")
}
func clustersListTest(
t *testing.T, params *utils.DeisTestConfig, notflag bool) {
utils.CheckList(t, clustersListCmd, params, params.ClusterName, notflag)
}
func clustersUpdateTest(t *testing.T, params *utils.DeisTestConfig) {
// Regression test for https://github.com/deis/deis/pull/1283
// Check that we didn't store the path of the key in the cluster.
utils.CheckList(t, clustersUpdateCmd, params, "~/.ssh/", true)
}