From 4ddc2ddf216a1a469c1b0711816bd08d98ddb608 Mon Sep 17 00:00:00 2001 From: Steven Danna Date: Tue, 17 Aug 2021 10:14:03 +0100 Subject: [PATCH] roachtest: pass env vars to roachprod via multiple --env flags Roachprod now shell escapes environment variables when rendering its start script. As a result, multiple environment variables passed as a single string, such as: --env "COCKROACH_MEMPROF_INTERVAL=1m COCKROACH_DISABLE_QUIESCENCE=true" would result in us exporting it as a single entry: export 'COCKROACH_MEMPROF_INTERVAL=1m COCKROACH_DISABLE_QUIESCENCE=true' which results in a single environment variable getting exported COCKROACH_MEMPROF_INTERVAL='1m COCKROACH_DISABLE_QUIESCENCE=true' I've converted the tests that were passing multiple environment variables in this was to passing them via multiple invocations of the `--env` flag. This seem preferable than teaching roachprod more sophisticated environment variable parsing. Release note: None --- pkg/cmd/roachtest/tests/clearrange.go | 3 ++- pkg/cmd/roachtest/tests/kv.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cmd/roachtest/tests/clearrange.go b/pkg/cmd/roachtest/tests/clearrange.go index 6dc85c2367a7..1d9e184c3e68 100644 --- a/pkg/cmd/roachtest/tests/clearrange.go +++ b/pkg/cmd/roachtest/tests/clearrange.go @@ -79,7 +79,8 @@ func runClearRange(ctx context.Context, t test.Test, c cluster.Cluster, aggressi // // NB: the below invocation was found to actually make it to the server at the time of writing. opts = append(opts, option.StartArgs( - "--env", "COCKROACH_CONSISTENCY_AGGRESSIVE=true COCKROACH_ENFORCE_CONSISTENT_STATS=true", + "--env", "COCKROACH_CONSISTENCY_AGGRESSIVE=true", + "--env", "COCKROACH_ENFORCE_CONSISTENT_STATS=true", )) } c.Start(ctx, opts...) diff --git a/pkg/cmd/roachtest/tests/kv.go b/pkg/cmd/roachtest/tests/kv.go index c33827105a42..3be149b45bce 100644 --- a/pkg/cmd/roachtest/tests/kv.go +++ b/pkg/cmd/roachtest/tests/kv.go @@ -628,9 +628,8 @@ func registerKVSplits(r registry.Registry) { c.Put(ctx, t.Cockroach(), "./cockroach", c.Range(1, nodes)) c.Put(ctx, t.DeprecatedWorkload(), "./workload", c.Node(nodes+1)) c.Start(ctx, c.Range(1, nodes), option.StartArgs( - // NB: this works. Don't change it or only one of the two vars may actually - // make it to the server. - "--env", "COCKROACH_MEMPROF_INTERVAL=1m COCKROACH_DISABLE_QUIESCENCE="+strconv.FormatBool(!item.quiesce), + "--env", "COCKROACH_MEMPROF_INTERVAL=1m", + "--env", "COCKROACH_DISABLE_QUIESCENCE="+strconv.FormatBool(!item.quiesce), "--args=--cache=256MiB", ))