bc800a18d1
Some tests may chose to deregister jobs to check Nomad cleanup logic, however, it is still possible for the test to fail and exit before this is hit. This therefore adds a cancellable cleanup func which can be deferred, using context to control whether it gets run or not.
46 lines
739 B
HCL
46 lines
739 B
HCL
job "service_discovery" {
|
|
datacenters = ["dc1"]
|
|
type = "service"
|
|
|
|
constraint {
|
|
attribute = "${attr.kernel.name}"
|
|
value = "linux"
|
|
}
|
|
|
|
group "service_discovery" {
|
|
|
|
service {
|
|
name = "http-api"
|
|
provider = "consul"
|
|
tags = ["foo", "bar"]
|
|
}
|
|
|
|
task "test" {
|
|
driver = "raw_exec"
|
|
|
|
config {
|
|
command = "bash"
|
|
args = ["-c", "sleep 15000"]
|
|
}
|
|
}
|
|
}
|
|
|
|
group "service_discovery_secondary" {
|
|
|
|
service {
|
|
name = "http-api-nomad"
|
|
provider = "nomad"
|
|
tags = ["foo", "bar"]
|
|
}
|
|
|
|
task "test" {
|
|
driver = "raw_exec"
|
|
|
|
config {
|
|
command = "bash"
|
|
args = ["-c", "sleep 15000"]
|
|
}
|
|
}
|
|
}
|
|
}
|