Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Commit 1f37aee

Browse files
committed
Add test
1 parent 41bf62d commit 1f37aee

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

test/deploy_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ func TestDeploy_canary(t *testing.T) {
135135
})
136136
}
137137

138+
func TestDeploy_failed_deploy_with_no_update(t *testing.T) {
139+
acctest.Test(t, acctest.TestCase{
140+
Steps: []acctest.TestStep{
141+
{
142+
Runner: acctest.DeployTestStepRunner{
143+
FixtureName: "deploy_fail_with_no_update.nomad",
144+
},
145+
ExpectErr: true,
146+
Check: acctest.CheckDeploymentStatus("failed"),
147+
},
148+
},
149+
CleanupFunc: acctest.CleanupPurgeJob,
150+
})
151+
}
152+
138153
func TestDeploy_lifecycle(t *testing.T) {
139154
acctest.Test(t, acctest.TestCase{
140155
Steps: []acctest.TestStep{
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
job "[[.job_name]]" {
2+
datacenters = ["dc1"]
3+
type = "service"
4+
5+
group "test" {
6+
count = 1
7+
8+
restart {
9+
attempts = 1
10+
interval = "5s"
11+
delay = "1s"
12+
mode = "fail"
13+
}
14+
15+
ephemeral_disk {
16+
size = 300
17+
}
18+
19+
update {
20+
max_parallel = 1
21+
min_healthy_time = "10s"
22+
healthy_deadline = "1m"
23+
}
24+
25+
network {
26+
port "http" {
27+
to = 80
28+
}
29+
}
30+
31+
service {
32+
name = "fake-service"
33+
port = "http"
34+
35+
check {
36+
name = "alive"
37+
type = "tcp"
38+
interval = "10s"
39+
timeout = "2s"
40+
}
41+
}
42+
43+
task "alpine" {
44+
driver = "docker"
45+
config {
46+
image = "alpine"
47+
command = "sleep 1 && exit 1"
48+
}
49+
resources {
50+
cpu = 100
51+
memory = 20
52+
network {
53+
mbits = 10
54+
}
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)