|
| 1 | +package verbose |
| 2 | + |
| 3 | +import ( |
| 4 | + _ "fmt" |
| 5 | + "github.com/deis/deis/tests/integration-utils" |
| 6 | + "testing" |
| 7 | +) |
| 8 | + |
| 9 | +func clustersSetup(t *testing.T) *ClusterDetails { |
| 10 | + cfg := itutils.GlobalSetup(t) |
| 11 | + cscfg := itutils.ClusterDetails{ |
| 12 | + cfg.ClusterName, |
| 13 | + cfg.Hosts, |
| 14 | + "172.17.8.100", |
| 15 | + cfg.AuthKey, |
| 16 | + cfg.HostName, |
| 17 | + } |
| 18 | + cmd := itutils.GetCommand("keys", "add") |
| 19 | + itutils.Execute(t, cmd, cfg, false, "") |
| 20 | + return &cscfg |
| 21 | +} |
| 22 | + |
| 23 | +func clustersCreateTest(t *testing.T, params *ClusterDetails) { |
| 24 | + cmd := itutils.GetCommand("clusters", "create") |
| 25 | + itutils.Execute(t, cmd, params, false, "") |
| 26 | + itutils.Execute(t, cmd, params, true, "Cluster with this Id already exists") |
| 27 | +} |
| 28 | + |
| 29 | +func clustersListTest(t *testing.T, params *ClusterDetails) { |
| 30 | + cmd := itutils.GetCommand("clusters", "list") |
| 31 | + itutils.Execute(t, cmd, params, false, "") |
| 32 | +} |
| 33 | + |
| 34 | +func clustersInfoTest(t *testing.T, params *ClusterDetails) { |
| 35 | + cmd := itutils.GetCommand("clusters", "info") |
| 36 | + itutils.Execute(t, cmd, params, false, "") |
| 37 | + params.ClusterName = "kin" |
| 38 | + itutils.Execute(t, cmd, params, true, "Not found") |
| 39 | + params.ClusterName = "dev" |
| 40 | +} |
| 41 | + |
| 42 | +func clustersUpdateTest(t *testing.T, params *ClusterDetails) { |
| 43 | + cmd := itutils.GetCommand("clusters", "update") |
| 44 | + itutils.Execute(t, cmd, params, false, "") |
| 45 | + params.ClusterName = "kin" |
| 46 | + itutils.Execute(t, cmd, params, true, "Not found") |
| 47 | + params.ClusterName = "dev" |
| 48 | +} |
| 49 | + |
| 50 | +func clustersDestroyTest(t *testing.T, params *ClusterDetails) { |
| 51 | + cmd := itutils.GetCommand("clusters", "destroy") |
| 52 | + itutils.Execute(t, cmd, params, false, "") |
| 53 | + itutils.Execute(t, cmd, params, true, "Not found") |
| 54 | +} |
| 55 | + |
| 56 | +func TestKeys(t *testing.T) { |
| 57 | + params := clustersSetup(t) |
| 58 | + clustersCreateTest(t, params) |
| 59 | + clustersListTest(t, params) |
| 60 | + clustersInfoTest(t, params) |
| 61 | + clustersUpdateTest(t, params) |
| 62 | + //clustersDestroyTest(t, params) |
| 63 | + |
| 64 | +} |
0 commit comments