From 8b55fd6b70325199f7627044cae59917f215c942 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 4 Feb 2016 16:50:20 -0800 Subject: [PATCH 1/2] Only interpret vars wrapped in braces --- command/init.go | 2 +- helper/args/args.go | 8 ++----- helper/args/args_test.go | 10 ++++---- nomad/mock/mock.go | 4 ++-- nomad/structs/node_class.go | 6 ++--- nomad/structs/node_class_test.go | 12 +++++----- scheduler/context_test.go | 8 +++---- scheduler/feasible.go | 16 ++++++------- scheduler/feasible_test.go | 24 ++++++++++---------- scheduler/generic_sched_test.go | 2 +- scheduler/stack_test.go | 6 ++--- website/source/docs/drivers/docker.html.md | 2 +- website/source/docs/drivers/exec.html.md | 2 +- website/source/docs/drivers/java.html.md | 2 +- website/source/docs/drivers/raw_exec.html.md | 2 +- website/source/docs/drivers/rkt.html.md | 2 +- website/source/docs/http/alloc.html.md | 2 +- website/source/docs/http/job.html.md | 6 ++--- website/source/docs/http/node.html.md | 2 +- website/source/docs/jobspec/index.html.md | 16 ++++++------- 20 files changed, 65 insertions(+), 69 deletions(-) diff --git a/command/init.go b/command/init.go index f968e034a6fd..a0b7d988ffdf 100644 --- a/command/init.go +++ b/command/init.go @@ -84,7 +84,7 @@ job "example" { # Restrict our job to only linux. We can specify multiple # constraints as needed. constraint { - attribute = "$attr.kernel.name" + attribute = "${attr.kernel.name}" value = "linux" } diff --git a/helper/args/args.go b/helper/args/args.go index d63fdd5221b2..886082e8ab49 100644 --- a/helper/args/args.go +++ b/helper/args/args.go @@ -3,7 +3,7 @@ package args import "regexp" var ( - envRe = regexp.MustCompile(`\$({[a-zA-Z0-9_\.]+}|[a-zA-Z0-9_\.]+)`) + envRe = regexp.MustCompile(`\${[a-zA-Z0-9_\.]+}`) ) // ReplaceEnv takes an arg and replaces all occurences of environment variables. @@ -11,11 +11,7 @@ var ( // original string is returned. func ReplaceEnv(arg string, environents ...map[string]string) string { return envRe.ReplaceAllStringFunc(arg, func(arg string) string { - stripped := arg[1:] - if stripped[0] == '{' { - stripped = stripped[1 : len(stripped)-1] - } - + stripped := arg[2 : len(arg)-1] for _, env := range environents { if value, ok := env[stripped]; ok { return value diff --git a/helper/args/args_test.go b/helper/args/args_test.go index 11b33103e60a..b430c985907b 100644 --- a/helper/args/args_test.go +++ b/helper/args/args_test.go @@ -24,8 +24,8 @@ var ( ) func TestArgs_ReplaceEnv_Invalid(t *testing.T) { - input := "$FOO" - exp := "$FOO" + input := "${FOO}" + exp := input act := ReplaceEnv(input, envVars) if !reflect.DeepEqual(act, exp) { @@ -34,7 +34,7 @@ func TestArgs_ReplaceEnv_Invalid(t *testing.T) { } func TestArgs_ReplaceEnv_Valid(t *testing.T) { - input := fmt.Sprintf(`"$%v"!`, ipKey) + input := fmt.Sprintf(`"${%v}"!`, ipKey) exp := fmt.Sprintf("\"%s\"!", ipVal) act := ReplaceEnv(input, envVars) @@ -44,7 +44,7 @@ func TestArgs_ReplaceEnv_Valid(t *testing.T) { } func TestArgs_ReplaceEnv_Period(t *testing.T) { - input := fmt.Sprintf(`"$%v"!`, periodKey) + input := fmt.Sprintf(`"${%v}"!`, periodKey) exp := fmt.Sprintf("\"%s\"!", periodVal) act := ReplaceEnv(input, envVars) @@ -54,7 +54,7 @@ func TestArgs_ReplaceEnv_Period(t *testing.T) { } func TestArgs_ReplaceEnv_Chained(t *testing.T) { - input := fmt.Sprintf("$%s$%s", ipKey, portKey) + input := fmt.Sprintf("${%s}${%s}", ipKey, portKey) exp := fmt.Sprintf("%s%s", ipVal, portVal) act := ReplaceEnv(input, envVars) diff --git a/nomad/mock/mock.go b/nomad/mock/mock.go index 7aa718c4ce6d..c0d6705ef420 100644 --- a/nomad/mock/mock.go +++ b/nomad/mock/mock.go @@ -67,7 +67,7 @@ func Job() *structs.Job { Datacenters: []string{"dc1"}, Constraints: []*structs.Constraint{ &structs.Constraint{ - LTarget: "$attr.kernel.name", + LTarget: "${attr.kernel.name}", RTarget: "linux", Operand: "=", }, @@ -145,7 +145,7 @@ func SystemJob() *structs.Job { Datacenters: []string{"dc1"}, Constraints: []*structs.Constraint{ &structs.Constraint{ - LTarget: "$attr.kernel.name", + LTarget: "${attr.kernel.name}", RTarget: "linux", Operand: "=", }, diff --git a/nomad/structs/node_class.go b/nomad/structs/node_class.go index 44f0375d5a43..aab0700550b5 100644 --- a/nomad/structs/node_class.go +++ b/nomad/structs/node_class.go @@ -82,11 +82,11 @@ func EscapedConstraints(constraints []*Constraint) []*Constraint { // computed node class optimization. func constraintTargetEscapes(target string) bool { switch { - case strings.HasPrefix(target, "$node.unique."): + case strings.HasPrefix(target, "${node.unique."): return true - case strings.HasPrefix(target, "$attr.unique."): + case strings.HasPrefix(target, "${attr.unique."): return true - case strings.HasPrefix(target, "$meta.unique."): + case strings.HasPrefix(target, "${meta.unique."): return true default: return false diff --git a/nomad/structs/node_class_test.go b/nomad/structs/node_class_test.go index 1759bece79fa..245fd27eb282 100644 --- a/nomad/structs/node_class_test.go +++ b/nomad/structs/node_class_test.go @@ -172,34 +172,34 @@ func TestNode_ComputedClass_Meta(t *testing.T) { func TestNode_EscapedConstraints(t *testing.T) { // Non-escaped constraints ne1 := &Constraint{ - LTarget: "$attr.kernel.name", + LTarget: "${attr.kernel.name}", RTarget: "linux", Operand: "=", } ne2 := &Constraint{ - LTarget: "$meta.key_foo", + LTarget: "${meta.key_foo}", RTarget: "linux", Operand: "<", } ne3 := &Constraint{ - LTarget: "$node.dc", + LTarget: "${node.dc}", RTarget: "test", Operand: "!=", } // Escaped constraints e1 := &Constraint{ - LTarget: "$attr.unique.kernel.name", + LTarget: "${attr.unique.kernel.name}", RTarget: "linux", Operand: "=", } e2 := &Constraint{ - LTarget: "$meta.unique.key_foo", + LTarget: "${meta.unique.key_foo}", RTarget: "linux", Operand: "<", } e3 := &Constraint{ - LTarget: "$unique.node.id", + LTarget: "${unique.node.id}", RTarget: "test", Operand: "!=", } diff --git a/scheduler/context_test.go b/scheduler/context_test.go index b8b3cbfa2df0..4b0e4011f917 100644 --- a/scheduler/context_test.go +++ b/scheduler/context_test.go @@ -166,22 +166,22 @@ func TestEvalEligibility_TaskGroupStatus(t *testing.T) { func TestEvalEligibility_SetJob(t *testing.T) { e := NewEvalEligibility() ne1 := &structs.Constraint{ - LTarget: "$attr.kernel.name", + LTarget: "${attr.kernel.name}", RTarget: "linux", Operand: "=", } e1 := &structs.Constraint{ - LTarget: "$attr.unique.kernel.name", + LTarget: "${attr.unique.kernel.name}", RTarget: "linux", Operand: "=", } e2 := &structs.Constraint{ - LTarget: "$meta.unique.key_foo", + LTarget: "${meta.unique.key_foo}", RTarget: "linux", Operand: "<", } e3 := &structs.Constraint{ - LTarget: "$meta.unique.key_foo", + LTarget: "${meta.unique.key_foo}", RTarget: "Windows", Operand: "<", } diff --git a/scheduler/feasible.go b/scheduler/feasible.go index a9cd0b7feef6..55a75ac1c58b 100644 --- a/scheduler/feasible.go +++ b/scheduler/feasible.go @@ -296,25 +296,25 @@ func resolveConstraintTarget(target string, node *structs.Node) (interface{}, bo // Handle the interpolations switch { - case "$node.unique.id" == target: + case "${node.unique.id}" == target: return node.ID, true - case "$node.datacenter" == target: + case "${node.datacenter}" == target: return node.Datacenter, true - case "$node.unique.name" == target: + case "${node.unique.name}" == target: return node.Name, true - case "$node.class" == target: + case "${node.class}" == target: return node.NodeClass, true - case strings.HasPrefix(target, "$attr."): - attr := strings.TrimPrefix(target, "$attr.") + case strings.HasPrefix(target, "${attr."): + attr := strings.TrimSuffix(strings.TrimPrefix(target, "${attr."), "}") val, ok := node.Attributes[attr] return val, ok - case strings.HasPrefix(target, "$meta."): - meta := strings.TrimPrefix(target, "$meta.") + case strings.HasPrefix(target, "${meta."): + meta := strings.TrimSuffix(strings.TrimPrefix(target, "${meta."), "}") val, ok := node.Meta[meta] return val, ok diff --git a/scheduler/feasible_test.go b/scheduler/feasible_test.go index 5a69761ad973..26802a4bcc9c 100644 --- a/scheduler/feasible_test.go +++ b/scheduler/feasible_test.go @@ -139,17 +139,17 @@ func TestConstraintChecker(t *testing.T) { constraints := []*structs.Constraint{ &structs.Constraint{ Operand: "=", - LTarget: "$node.datacenter", + LTarget: "${node.datacenter}", RTarget: "dc1", }, &structs.Constraint{ Operand: "is", - LTarget: "$attr.kernel.name", + LTarget: "${attr.kernel.name}", RTarget: "linux", }, &structs.Constraint{ Operand: "is", - LTarget: "$node.class", + LTarget: "${node.class}", RTarget: "large", }, } @@ -189,53 +189,53 @@ func TestResolveConstraintTarget(t *testing.T) { node := mock.Node() cases := []tcase{ { - target: "$node.unique.id", + target: "${node.unique.id}", node: node, val: node.ID, result: true, }, { - target: "$node.datacenter", + target: "${node.datacenter}", node: node, val: node.Datacenter, result: true, }, { - target: "$node.unique.name", + target: "${node.unique.name}", node: node, val: node.Name, result: true, }, { - target: "$node.class", + target: "${node.class}", node: node, val: node.NodeClass, result: true, }, { - target: "$node.foo", + target: "${node.foo}", node: node, result: false, }, { - target: "$attr.kernel.name", + target: "${attr.kernel.name}", node: node, val: node.Attributes["kernel.name"], result: true, }, { - target: "$attr.rand", + target: "${attr.rand}", node: node, result: false, }, { - target: "$meta.pci-dss", + target: "${meta.pci-dss}", node: node, val: node.Meta["pci-dss"], result: true, }, { - target: "$meta.rand", + target: "${meta.rand}", node: node, result: false, }, diff --git a/scheduler/generic_sched_test.go b/scheduler/generic_sched_test.go index e0506b8a9659..55647ee0c534 100644 --- a/scheduler/generic_sched_test.go +++ b/scheduler/generic_sched_test.go @@ -238,7 +238,7 @@ func TestServiceSched_JobRegister_FeasibleAndInfeasibleTG(t *testing.T) { job.TaskGroups[0].Count = 2 job.TaskGroups[0].Constraints = append(job.Constraints, &structs.Constraint{ - LTarget: "$node.class", + LTarget: "${node.class}", RTarget: "class_0", Operand: "=", }, diff --git a/scheduler/stack_test.go b/scheduler/stack_test.go index c0d9c4858158..dfab71e042ec 100644 --- a/scheduler/stack_test.go +++ b/scheduler/stack_test.go @@ -40,7 +40,7 @@ func benchmarkServiceStack_MetaKeyConstraint(b *testing.B, key string, numNodes, // Create a job whose constraint meets two node classes. job := mock.Job() job.Constraints[0] = &structs.Constraint{ - LTarget: "$meta." + key, + LTarget: fmt.Sprintf("${meta.%v}", key), RTarget: "1", Operand: "<", } @@ -224,7 +224,7 @@ func TestServiceStack_Select_ConstraintFilter(t *testing.T) { if met.ClassFiltered["linux-medium-pci"] != 1 { t.Fatalf("bad: %#v", met) } - if met.ConstraintFiltered["$attr.kernel.name = freebsd"] != 1 { + if met.ConstraintFiltered["${attr.kernel.name} = freebsd"] != 1 { t.Fatalf("bad: %#v", met) } } @@ -440,7 +440,7 @@ func TestSystemStack_Select_ConstraintFilter(t *testing.T) { if met.ClassFiltered["linux-medium-pci"] != 1 { t.Fatalf("bad: %#v", met) } - if met.ConstraintFiltered["$attr.kernel.name = freebsd"] != 1 { + if met.ConstraintFiltered["${attr.kernel.name} = freebsd"] != 1 { t.Fatalf("bad: %#v", met) } } diff --git a/website/source/docs/drivers/docker.html.md b/website/source/docs/drivers/docker.html.md index 2534cba2f33e..140522b15606 100644 --- a/website/source/docs/drivers/docker.html.md +++ b/website/source/docs/drivers/docker.html.md @@ -44,7 +44,7 @@ The following options are available for use in the job specification. before launching the task. For example: ``` - args = ["$nomad.ip", "$MY_ENV", "$meta.foo"] + args = ["${nomad.ip}", "${MY_ENV}", "${meta.foo}"] ``` * `labels` - (Optional) A key/value map of labels to set to the containers on diff --git a/website/source/docs/drivers/exec.html.md b/website/source/docs/drivers/exec.html.md index a2b05f168630..fd64569bfc8d 100644 --- a/website/source/docs/drivers/exec.html.md +++ b/website/source/docs/drivers/exec.html.md @@ -38,7 +38,7 @@ The `exec` driver supports the following configuration in the job spec: before launching the task. For example: ``` - args = ["$nomad.ip", "$MY_ENV", "$meta.foo"] + args = ["${nomad.ip}", "${MY_ENV}", "${meta.foo}"] ``` ## Client Requirements diff --git a/website/source/docs/drivers/java.html.md b/website/source/docs/drivers/java.html.md index f79e6c77c471..6f1473e3c5be 100644 --- a/website/source/docs/drivers/java.html.md +++ b/website/source/docs/drivers/java.html.md @@ -33,7 +33,7 @@ The `java` driver supports the following configuration in the job spec: before launching the task. For example: ``` - args = ["$nomad.ip", "$MY_ENV", "$meta.foo"] + args = ["${nomad.ip}", "${MY_ENV}", "${meta.foo}"] ``` * `jvm_options` - (Optional) A list of JVM options to be passed while invoking diff --git a/website/source/docs/drivers/raw_exec.html.md b/website/source/docs/drivers/raw_exec.html.md index 90b3f24c7a43..520ea70ee50c 100644 --- a/website/source/docs/drivers/raw_exec.html.md +++ b/website/source/docs/drivers/raw_exec.html.md @@ -36,7 +36,7 @@ The `raw_exec` driver supports the following configuration in the job spec: before launching the task. For example: ``` - args = ["$nomad.ip", "$MY_ENV", "$meta.foo"] + args = ["${nomad.ip}", "${MY_ENV}", "${meta.foo}"] ``` ## Client Requirements diff --git a/website/source/docs/drivers/rkt.html.md b/website/source/docs/drivers/rkt.html.md index 6225faf87067..6ed0cd8b5126 100644 --- a/website/source/docs/drivers/rkt.html.md +++ b/website/source/docs/drivers/rkt.html.md @@ -30,7 +30,7 @@ The `rkt` driver supports the following configuration in the job spec: before launching the task. For example: ``` - args = ["$nomad.ip", "$MY_ENV", $meta.foo"] + args = ["${nomad.ip}", "${MY_ENV}", ${meta.foo}"] ``` * `trust_prefix` - (Optional) The trust prefix to be passed to rkt. Must be diff --git a/website/source/docs/http/alloc.html.md b/website/source/docs/http/alloc.html.md index defebdfb6e00..c507e81bd2b9 100644 --- a/website/source/docs/http/alloc.html.md +++ b/website/source/docs/http/alloc.html.md @@ -166,7 +166,7 @@ be specified using the `?region=` query parameter. { "Operand": "=", "RTarget": "linux", - "LTarget": "$attr.kernel.name" + "LTarget": "${attr.kernel.name}" } ] }, diff --git a/website/source/docs/http/job.html.md b/website/source/docs/http/job.html.md index 867389bcc054..d9679620c196 100644 --- a/website/source/docs/http/job.html.md +++ b/website/source/docs/http/job.html.md @@ -52,7 +52,7 @@ region is used; another region can be specified using the `?region=` query param ], "Constraints": [ { - "LTarget": "kernel.os", + "LTarget": "${attr.kernel.os}", "RTarget": "windows", "Operand": "=", } @@ -63,7 +63,7 @@ region is used; another region can be specified using the `?region=` query param "Count": 5, "Constraints": [ { - "LTarget": "kernel.os", + "LTarget": "${attr.kernel.os}", "RTarget": "linux", "Operand": "=", } @@ -102,7 +102,7 @@ region is used; another region can be specified using the `?region=` query param }, "Constraints": [ { - "LTarget": "kernel.arch", + "LTarget": "${attr.kernel.arch}", "RTarget": "amd64", "Operand": "=", } diff --git a/website/source/docs/http/node.html.md b/website/source/docs/http/node.html.md index 794e0283abeb..01f06ceef8ac 100644 --- a/website/source/docs/http/node.html.md +++ b/website/source/docs/http/node.html.md @@ -241,7 +241,7 @@ be specified using the `?region=` query parameter. { "Operand": "=", "RTarget": "linux", - "LTarget": "$attr.kernel.name" + "LTarget": "${attr.kernel.name}" } ] }, diff --git a/website/source/docs/jobspec/index.html.md b/website/source/docs/jobspec/index.html.md index 7c59991813ad..0f66462caa65 100644 --- a/website/source/docs/jobspec/index.html.md +++ b/website/source/docs/jobspec/index.html.md @@ -93,7 +93,7 @@ where a task is eligible for running. An example constraint looks like: ``` # Restrict to only nodes running linux constraint { - attribute = "$attr.kernel.name" + attribute = "${attr.kernel.name}" value = "linux" } ``` @@ -252,7 +252,7 @@ The `task` object supports the following keys: env { // The value will be interpreted by the client and set to the // correct value. - NODE_CLASS = "$nomad.class" + NODE_CLASS = "${nomad.class}" } ``` @@ -388,27 +388,27 @@ variables that can be interpreted: Description - $node.id + ${node.id} The client node identifier - $node.datacenter + ${node.datacenter} The client node datacenter - $node.name + ${node.name} The client node name - $node.class + ${node.class} The client node class - $attr.\ + ${attr.\ The attribute given by `key` on the client node. - $meta.\ + ${meta.\} The metadata value given by `key` on the client node. From 0c46a0ec1d961cde17534ddda6336dd264660d3a Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 4 Feb 2016 17:21:00 -0800 Subject: [PATCH 2/2] Fix tests --- client/driver/env/env_test.go | 18 +++++++++--------- client/driver/exec_test.go | 2 +- client/driver/raw_exec_test.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/client/driver/env/env_test.go b/client/driver/env/env_test.go index 6cd476b108a5..de2d6805d899 100644 --- a/client/driver/env/env_test.go +++ b/client/driver/env/env_test.go @@ -61,7 +61,7 @@ func testTaskEnvironment() *TaskEnvironment { func TestEnvironment_ParseAndReplace_Env(t *testing.T) { env := testTaskEnvironment() - input := []string{fmt.Sprintf(`"$%v"!`, envOneKey), fmt.Sprintf("$%s$%s", envOneKey, envTwoKey)} + input := []string{fmt.Sprintf(`"${%v}"!`, envOneKey), fmt.Sprintf("${%s}${%s}", envOneKey, envTwoKey)} act := env.ParseAndReplace(input) exp := []string{fmt.Sprintf(`"%s"!`, envOneVal), fmt.Sprintf("%s%s", envOneVal, envTwoVal)} @@ -71,7 +71,7 @@ func TestEnvironment_ParseAndReplace_Env(t *testing.T) { } func TestEnvironment_ParseAndReplace_Meta(t *testing.T) { - input := []string{fmt.Sprintf("$%v%v", nodeMetaPrefix, metaKey)} + input := []string{fmt.Sprintf("${%v%v}", nodeMetaPrefix, metaKey)} exp := []string{metaVal} env := testTaskEnvironment() act := env.ParseAndReplace(input) @@ -82,7 +82,7 @@ func TestEnvironment_ParseAndReplace_Meta(t *testing.T) { } func TestEnvironment_ParseAndReplace_Attr(t *testing.T) { - input := []string{fmt.Sprintf("$%v%v", nodeAttributePrefix, attrKey)} + input := []string{fmt.Sprintf("${%v%v}", nodeAttributePrefix, attrKey)} exp := []string{attrVal} env := testTaskEnvironment() act := env.ParseAndReplace(input) @@ -93,7 +93,7 @@ func TestEnvironment_ParseAndReplace_Attr(t *testing.T) { } func TestEnvironment_ParseAndReplace_Node(t *testing.T) { - input := []string{fmt.Sprintf("$%v", nodeNameKey), fmt.Sprintf("$%v", nodeClassKey)} + input := []string{fmt.Sprintf("${%v}", nodeNameKey), fmt.Sprintf("${%v}", nodeClassKey)} exp := []string{nodeName, nodeClass} env := testTaskEnvironment() act := env.ParseAndReplace(input) @@ -105,9 +105,9 @@ func TestEnvironment_ParseAndReplace_Node(t *testing.T) { func TestEnvironment_ParseAndReplace_Mixed(t *testing.T) { input := []string{ - fmt.Sprintf("$%v$%v%v", nodeNameKey, nodeAttributePrefix, attrKey), - fmt.Sprintf("$%v$%v%v", nodeClassKey, nodeMetaPrefix, metaKey), - fmt.Sprintf("$%v$%v", envTwoKey, nodeClassKey), + fmt.Sprintf("${%v}${%v%v}", nodeNameKey, nodeAttributePrefix, attrKey), + fmt.Sprintf("${%v}${%v%v}", nodeClassKey, nodeMetaPrefix, metaKey), + fmt.Sprintf("${%v}${%v}", envTwoKey, nodeClassKey), } exp := []string{ fmt.Sprintf("%v%v", nodeName, attrVal), @@ -123,7 +123,7 @@ func TestEnvironment_ParseAndReplace_Mixed(t *testing.T) { } func TestEnvironment_ReplaceEnv_Mixed(t *testing.T) { - input := fmt.Sprintf("$%v$%v%v", nodeNameKey, nodeAttributePrefix, attrKey) + input := fmt.Sprintf("${%v}${%v%v}", nodeNameKey, nodeAttributePrefix, attrKey) exp := fmt.Sprintf("%v%v", nodeName, attrVal) env := testTaskEnvironment() act := env.ReplaceEnv(input) @@ -193,7 +193,7 @@ func TestEnvironment_ClearEnvvars(t *testing.T) { func TestEnvironment_Interprolate(t *testing.T) { env := testTaskEnvironment(). - SetEnvvars(map[string]string{"test": "$node.class", "test2": "$attr.arch"}). + SetEnvvars(map[string]string{"test": "${node.class}", "test2": "${attr.arch}"}). Build() act := env.EnvList() diff --git a/client/driver/exec_test.go b/client/driver/exec_test.go index 1f1404289958..853c90cb0462 100644 --- a/client/driver/exec_test.go +++ b/client/driver/exec_test.go @@ -212,7 +212,7 @@ func TestExecDriver_Start_Wait_AllocDir(t *testing.T) { "command": "/bin/bash", "args": []string{ "-c", - fmt.Sprintf(`sleep 1; echo -n %s > $%s/%s`, string(exp), env.AllocDir, file), + fmt.Sprintf(`sleep 1; echo -n %s > ${%s}/%s`, string(exp), env.AllocDir, file), }, }, Resources: basicResources, diff --git a/client/driver/raw_exec_test.go b/client/driver/raw_exec_test.go index fffd55089d39..2597af880eec 100644 --- a/client/driver/raw_exec_test.go +++ b/client/driver/raw_exec_test.go @@ -231,7 +231,7 @@ func TestRawExecDriver_Start_Wait_AllocDir(t *testing.T) { t.Parallel() exp := []byte{'w', 'i', 'n'} file := "output.txt" - outPath := fmt.Sprintf(`$%s/%s`, env.AllocDir, file) + outPath := fmt.Sprintf(`${%s}/%s`, env.AllocDir, file) task := &structs.Task{ Name: "sleep", Config: map[string]interface{}{