github.com/hernad/nomad@v1.6.112/e2e/consul/input/checks_task_update.nomad (about) 1 # Copyright (c) HashiCorp, Inc. 2 # SPDX-License-Identifier: MPL-2.0 3 4 job "task_check" { 5 datacenters = ["dc1"] 6 type = "service" 7 8 constraint { 9 attribute = "${attr.kernel.name}" 10 value = "linux" 11 } 12 13 group "task_check" { 14 count = 1 15 16 task "test" { 17 service { 18 name = "task-service-1" 19 20 # after update, check name has changed 21 check { 22 name = "alive-1a" 23 type = "script" 24 task = "test" 25 interval = "2s" 26 timeout = "2s" 27 command = "echo" 28 args = ["alive-1a"] 29 } 30 } 31 32 service { 33 name = "task-service-2" 34 35 check { 36 name = "alive-2a" 37 type = "script" 38 task = "test" 39 interval = "2s" 40 timeout = "2s" 41 command = "echo" 42 args = ["alive-2a"] 43 } 44 45 # after updating, this check will always pass 46 check { 47 name = "alive-2b" 48 type = "script" 49 task = "test" 50 interval = "2s" 51 timeout = "2s" 52 command = "echo" 53 args = ["alive-2b"] 54 } 55 } 56 57 service { 58 name = "task-service-3" 59 60 # this check should always time out and so the service 61 # should not be marked healthy 62 check { 63 name = "always-dead" 64 type = "script" 65 task = "test" 66 interval = "2s" 67 timeout = "1s" 68 command = "sleep" 69 args = ["10"] 70 } 71 } 72 73 driver = "raw_exec" 74 75 config { 76 command = "bash" 77 args = ["-c", "sleep 15000"] 78 } 79 } 80 } 81 }