Skip to content

Commit bbb40e1

Browse files
committed
test(e2e): use exact-match grep for sandbox name checks
Harden `nemoclaw list` existence checks with `grep -Fqw --` so a sandbox name cannot be satisfied by a substring/prefix match (e.g. `test-dash` matching `test-dashboard-foo`). Addresses CodeRabbit review feedback on PR #2123. Signed-off-by: Evan Takahashi <evan10takahashi@gmail.com>
1 parent 71fe953 commit bbb40e1

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/e2e/test-dashboard-reachability.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ onboard_sandbox() {
7878
return 1
7979
fi
8080

81-
if ! nemoclaw list 2>/dev/null | grep -q "$name"; then
81+
if ! nemoclaw list 2>/dev/null | grep -Fqw -- "$name"; then
8282
log " [onboard_sandbox] Sandbox '$name' not found in nemoclaw list after onboard"
8383
return 1
8484
fi
@@ -136,7 +136,7 @@ install_nemoclaw() {
136136

137137
local install_sandbox
138138
install_sandbox="${NEMOCLAW_SANDBOX_NAME:-my-assistant}"
139-
if nemoclaw list 2>/dev/null | grep -q "$install_sandbox"; then
139+
if nemoclaw list 2>/dev/null | grep -Fqw -- "$install_sandbox"; then
140140
log "Destroying install sandbox '$install_sandbox'..."
141141
nemoclaw "$install_sandbox" destroy --yes 2>/dev/null || true
142142
fi
@@ -167,7 +167,7 @@ preflight() {
167167
rm -f "$HOME/.nemoclaw/onboard.lock"
168168
fi
169169

170-
if nemoclaw list 2>/dev/null | grep -q "$SANDBOX"; then
170+
if nemoclaw list 2>/dev/null | grep -Fqw -- "$SANDBOX"; then
171171
log "Cleaning up leftover sandbox: $SANDBOX"
172172
nemoclaw "$SANDBOX" destroy --yes 2>/dev/null || true
173173
fi
@@ -284,7 +284,7 @@ teardown() {
284284
log ""
285285
log "=== Teardown ==="
286286
openshell forward stop "$DASHBOARD_PORT" 2>/dev/null || true
287-
if nemoclaw list 2>/dev/null | grep -q "$SANDBOX"; then
287+
if nemoclaw list 2>/dev/null | grep -Fqw -- "$SANDBOX"; then
288288
log "Destroying sandbox '$SANDBOX'..."
289289
nemoclaw "$SANDBOX" destroy --yes 2>/dev/null || true
290290
fi

0 commit comments

Comments
 (0)