-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconfig_test.go
More file actions
66 lines (57 loc) · 1.83 KB
/
config_test.go
File metadata and controls
66 lines (57 loc) · 1.83 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
61
62
63
64
65
66
// +build integration
package tests
import (
"testing"
"github.com/deis/deis/tests/utils"
)
var (
configListCmd = "config:list --app={{.AppName}}"
configSetCmd = "config:set FOO=讲台 --app={{.AppName}}"
configSet2Cmd = "config:set FOO=10 --app={{.AppName}}"
configUnsetCmd = "config:unset FOO --app={{.AppName}}"
)
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)
limitsSetTest(t, params, 4)
appsOpenTest(t, params)
limitsUnsetTest(t, params, 6)
appsOpenTest(t, params)
//tagsTest(t, params, 8)
appsOpenTest(t, params)
utils.AppsDestroyTest(t, params)
}
func configSetup(t *testing.T) *utils.DeisTestConfig {
cfg := utils.GetGlobalConfig()
cfg.AppName = "configsample"
utils.Execute(t, authLoginCmd, cfg, false, "")
utils.Execute(t, gitCloneCmd, cfg, false, "")
if err := utils.Chdir(cfg.ExampleApp); err != nil {
t.Fatal(err)
}
utils.Execute(t, appsCreateCmd, cfg, false, "")
utils.Execute(t, gitPushCmd, cfg, false, "")
if err := utils.Chdir(".."); err != nil {
t.Fatal(err)
}
return cfg
}
func configListTest(
t *testing.T, params *utils.DeisTestConfig, notflag bool) {
utils.CheckList(t, configListCmd, params, "FOO", notflag)
}
func configSetTest(t *testing.T, params *utils.DeisTestConfig) {
utils.Execute(t, configSetCmd, params, false, "讲台")
utils.CheckList(t, appsInfoCmd, params, "(v3)", false)
utils.Execute(t, configSet2Cmd, params, false, "10")
utils.CheckList(t, appsInfoCmd, params, "(v4)", false)
}
func configUnsetTest(t *testing.T, params *utils.DeisTestConfig) {
utils.Execute(t, configUnsetCmd, params, false, "")
utils.CheckList(t, appsInfoCmd, params, "(v5)", false)
utils.CheckList(t, "run env --app={{.AppName}}", params, "FOO", true)
}