Skip to content

Commit 70b98c1

Browse files
committed
roachtest: fix check for npm being installed
We have seen that this check can return a 0 exit code even when the npm command doesn't exist. Using && should fix this by short-circuiting as soon as a non-zero exit code is received. Release note: None
1 parent 44853b2 commit 70b98c1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/cmd/roachtest/tests/javascript_helpers.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ func installNode18(
3434
// Check if node is already installed
3535
if err := c.RunE(
3636
ctx, option.WithNodes(node), `
37-
sudo npm i -g npm
38-
sudo find /usr/local/lib/node_modules/npm -type d -exec chmod 755 {} \;
39-
sudo find /usr/local/lib/node_modules/npm -type f -exec chmod 644 {} \;
40-
sudo find /usr/local/lib/node_modules/npm/bin -type f -exec chmod 755 {} \;
37+
sudo npm i -g npm && \
38+
sudo find /usr/local/lib/node_modules/npm -type d -exec chmod 755 {} && \
39+
sudo find /usr/local/lib/node_modules/npm -type f -exec chmod 644 {} && \
40+
sudo find /usr/local/lib/node_modules/npm/bin -type f -exec chmod 755 {}
4141
`,
4242
); err != nil {
4343

@@ -65,7 +65,7 @@ sudo find /usr/local/lib/node_modules/npm/bin -type f -exec chmod 755 {} \;
6565
node,
6666
"add nodesource key and deb repository",
6767
fmt.Sprintf(`
68-
set -euo pipefail
68+
set -euo pipefail && \
6969
curl -fsSL -o node-linux.tar.gz --compressed "%s" && \
7070
echo "%s node-linux.tar.gz" | sha256sum -c - && \
7171
sudo tar -xzf "node-linux.tar.gz" -C /usr/local --strip-components=1 --no-same-owner && \

0 commit comments

Comments
 (0)