From 4d4539fbad5a5d9bc66e390a69cd1016425752f7 Mon Sep 17 00:00:00 2001 From: Andy Yang Date: Tue, 24 Jan 2023 10:54:13 -0500 Subject: [PATCH] roachtest: fix env var passing in activerecord test This patch fixes the rails version pinning in the activerecord roachtest. The rails version is passed in via the env variable `RAILS_VERSION` and was previously being set before the `sudo` in the adapter install command and thus erroneously discarded. Release note: None --- pkg/cmd/roachtest/tests/activerecord.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/cmd/roachtest/tests/activerecord.go b/pkg/cmd/roachtest/tests/activerecord.go index 30b083557cb3..d1084b69c62b 100644 --- a/pkg/cmd/roachtest/tests/activerecord.go +++ b/pkg/cmd/roachtest/tests/activerecord.go @@ -159,7 +159,7 @@ func registerActiveRecord(r registry.Registry) { "installing gems", fmt.Sprintf( `cd /mnt/data1/activerecord-cockroachdb-adapter/ && `+ - `RAILS_VERSION=%s sudo bundle install`, supportedRailsVersion), + `sudo RAILS_VERSION=%s bundle install`, supportedRailsVersion), ); err != nil { t.Fatal(err) } @@ -172,8 +172,9 @@ func registerActiveRecord(r registry.Registry) { t.Status("running activerecord test suite") result, err := c.RunWithDetailsSingleNode(ctx, t.L(), node, - `cd /mnt/data1/activerecord-cockroachdb-adapter/ && `+ - `sudo RUBYOPT="-W0" TESTOPTS="-v" bundle exec rake test`, + fmt.Sprintf( + `cd /mnt/data1/activerecord-cockroachdb-adapter/ && `+ + `sudo RAILS_VERSION=%s RUBYOPT="-W0" TESTOPTS="-v" bundle exec rake test`, supportedRailsVersion), ) // Fatal for a roachprod or SSH error. A roachprod error is when result.Err==nil.