From 2a89e477465adbe6a88987f0dcb9fe80145d7b2f Mon Sep 17 00:00:00 2001 From: Tim Gross Date: Wed, 22 Jan 2020 09:54:54 -0500 Subject: [PATCH] e2e: ensure group script check tests interpolation (#6972) Fixes a bug introduced in 0aa58b9 where we're writing a test file to a taskdir-interpolated location, which works when we `alloc exec` but not in the jobspec for a group script check. This changeset also makes the test safe to run multiple times by namespacing the file with the alloc ID, which has the added bonus of exercising our alloc interpolation code for group script checks. --- e2e/consul/input/checks_group.nomad | 2 +- e2e/consul/script_checks.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/consul/input/checks_group.nomad b/e2e/consul/input/checks_group.nomad index 13b1b4011..fae1b9fc7 100644 --- a/e2e/consul/input/checks_group.nomad +++ b/e2e/consul/input/checks_group.nomad @@ -51,7 +51,7 @@ job "group_check" { interval = "2s" timeout = "2s" command = "cat" - args = ["alive-2b"] + args = ["/tmp/${NOMAD_ALLOC_ID}-alive-2b"] } } diff --git a/e2e/consul/script_checks.go b/e2e/consul/script_checks.go index 11cceb841..7e980eaed 100644 --- a/e2e/consul/script_checks.go +++ b/e2e/consul/script_checks.go @@ -50,7 +50,7 @@ func (tc *ScriptChecksE2ETest) TestGroupScriptCheck(f *framework.F) { // Check in warning state becomes healthy after check passes _, _, err := exec(nomadClient, allocs, - []string{"/bin/sh", "-c", "touch ${NOMAD_TASK_DIR}/alive-2b"}) + []string{"/bin/sh", "-c", "touch /tmp/${NOMAD_ALLOC_ID}-alive-2b"}) require.NoError(err) e2eutil.RequireConsulStatus(require, consulClient, "group-service-2", capi.HealthPassing)