forked from convox/rack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_test.go
75 lines (61 loc) · 1.92 KB
/
deploy_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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package main
import (
"testing"
"github.com/convox/rack/client"
"github.com/convox/rack/test"
)
func TestDeployPreventAgainstNonRunningStatus(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "creating"}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox deploy --app foo",
Exit: 1,
Stdout: "",
Stderr: "ERROR: unable to deploy foo in a non-running status: creating\n",
},
)
}
func TestDeployNoManifestFound(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "running"}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox deploy --app foo",
Exit: 1,
Stderr: "ERROR: no docker-compose.yml found, try `convox init` to generate one\n",
},
)
}
func TestDeployInvalidCronInManifest(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "running"}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox deploy --file docker-compose.invalid-cron-label.yml --app foo",
Dir: "../../manifest/fixtures",
Exit: 1,
Stderr: "ERROR: Cron task my_job is not valid (cron names can contain only alphanumeric characters, dashes and must be between 4 and 30 characters)\n",
},
)
}
func TestDeployDuplicateCronInManifest(t *testing.T) {
ts := testServer(t,
test.Http{Method: "GET", Path: "/apps/foo", Code: 200, Response: client.App{Name: "foo", Status: "running"}},
)
defer ts.Close()
test.Runs(t,
test.ExecRun{
Command: "convox deploy --file docker-compose.duplicate-cron-label.yml --app foo",
Dir: "../../manifest/fixtures",
Exit: 1,
Stderr: "ERROR: invalid docker-compose.duplicate-cron-label.yml: error loading manifest: duplicate cron label convox.cron.myjob\n",
},
)
}