Skip to content

Commit

Permalink
roachtest: pass env vars to roachprod via multiple --env flags
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stevendanna committed Aug 17, 2021
1 parent c7df691 commit 4ddc2dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/cmd/roachtest/tests/clearrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down
5 changes: 2 additions & 3 deletions pkg/cmd/roachtest/tests/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
))

Expand Down

0 comments on commit 4ddc2dd

Please sign in to comment.