-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig_test.go
More file actions
60 lines (50 loc) · 1.66 KB
/
config_test.go
File metadata and controls
60 lines (50 loc) · 1.66 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
60
// +build integration
package tests
import (
_ "fmt"
"testing"
"github.com/deis/deis/tests/integration-utils"
"github.com/deis/deis/tests/utils"
)
func configSetup(t *testing.T) *itutils.DeisTestConfig {
cfg := itutils.GetGlobalConfig()
cfg.AppName = "configsample"
cmd := itutils.GetCommand("auth", "login")
itutils.Execute(t, cmd, cfg, false, "")
cmd = itutils.GetCommand("git", "clone")
itutils.Execute(t, cmd, cfg, false, "")
cmd = itutils.GetCommand("apps", "create")
cmd1 := itutils.GetCommand("git", "push")
if err := utils.Chdir(cfg.ExampleApp); err != nil {
t.Fatalf("Failed:\n%v", err)
}
itutils.Execute(t, cmd, cfg, false, "")
itutils.Execute(t, cmd1, cfg, false, "")
if err := utils.Chdir(".."); err != nil {
t.Fatalf("Failed:\n%v", err)
}
return cfg
}
func configlistTest(t *testing.T, params *itutils.DeisTestConfig, notflag bool) {
cmd := itutils.GetCommand("config", "list")
itutils.CheckList(t, params, cmd, "jaf", notflag)
}
func configSetTest(t *testing.T, params *itutils.DeisTestConfig) {
cmd := itutils.GetCommand("config", "set")
itutils.Execute(t, cmd, params, false, "")
itutils.CheckList(t, params, itutils.GetCommand("apps", "info"), "(v3)", false)
}
func configUnsetTest(t *testing.T, params *itutils.DeisTestConfig) {
cmd := itutils.GetCommand("config", "unset")
itutils.Execute(t, cmd, params, false, "")
itutils.CheckList(t, params, itutils.GetCommand("apps", "info"), "(v4)", false)
}
func TestConfig(t *testing.T) {
params := configSetup(t)
configSetTest(t, params)
configlistTest(t, params, false)
appsOpenTest(t, params)
configUnsetTest(t, params)
configlistTest(t, params, true)
itutils.AppsDestroyTest(t, params)
}