Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mongey committed Apr 23, 2021
1 parent 41bf62d commit 09aac6b
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,21 @@ func TestDeploy_canary(t *testing.T) {
})
}

func TestDeploy_failed_deploy_with_no_update(t *testing.T) {
acctest.Test(t, acctest.TestCase{
Steps: []acctest.TestStep{
{
Runner: acctest.DeployTestStepRunner{
FixtureName: "deploy_fail_with_no_update.nomad",
},
ExpectErr: true,
Check: acctest.CheckDeploymentStatus("cancelled"),
},
},
CleanupFunc: acctest.CleanupPurgeJob,
})
}

func TestDeploy_lifecycle(t *testing.T) {
acctest.Test(t, acctest.TestCase{
Steps: []acctest.TestStep{
Expand Down
58 changes: 58 additions & 0 deletions test/fixtures/deploy_fail_with_no_update.nomad
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
job "[[.job_name]]" {
datacenters = ["dc1"]
type = "service"

group "test" {
count = 1

restart {
attempts = 1
interval = "5s"
delay = "1s"
mode = "fail"
}

ephemeral_disk {
size = 300
}

update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "1m"
}

network {
port "http" {
to = 80
}
}

service {
name = "fake-service"
port = "http"

check {
name = "alive"
type = "tcp"
interval = "10s"
timeout = "2s"
}
}

task "alpine" {
driver = "docker"
config {
image = "alpine"
command = "sleep 1 && exit 1"
}
resources {
cpu = 100
memory = 20
network {
mbits = 10
}
}
}
}
}

0 comments on commit 09aac6b

Please sign in to comment.