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