Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions test/e2e/lib/install-path-refresh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Shared install-path-refresh helper for e2e test scripts. Meant to be sourced;
# the shebang and executable bit satisfy repo shell-file conventions.
#
# Why: install.sh places the openshell/nemoclaw binaries under ~/.local/bin.
# Sourcing ~/.bashrc on GitHub runners triggers nvm.sh, which rebuilds $PATH
# from scratch and drops ~/.local/bin — so a post-install `command -v
# nemoclaw` check fails with "nemoclaw not found". This helper centralises
# the recovery so every e2e test script applies the same guard.
#
# Usage:
# . "$(dirname "${BASH_SOURCE[0]}")/lib/install-path-refresh.sh"
#
# # After running install.sh, reload the shell profile and pick up the
# # binaries it installed:
# nemoclaw_refresh_install_env
#
# # If you only need to defensively ensure ~/.local/bin is on PATH:
# nemoclaw_ensure_local_bin_on_path

# Prepend ~/.local/bin to PATH if it exists and isn't already there.
nemoclaw_ensure_local_bin_on_path() {
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
}

# Source ~/.bashrc (best-effort) and then ensure ~/.local/bin is on PATH.
# Needed after running install.sh because nvm.sh (loaded via .bashrc) rebuilds
# PATH from scratch and can drop the directory where install.sh places the
# openshell/nemoclaw binaries.
nemoclaw_refresh_install_env() {
if [ -f "$HOME/.bashrc" ]; then
# shellcheck source=/dev/null
source "$HOME/.bashrc" 2>/dev/null || true
fi
nemoclaw_ensure_local_bin_on_path
}
9 changes: 4 additions & 5 deletions test/e2e/test-cloud-inference-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ CLOUD_MODEL="${NEMOCLAW_CLOUD_EXPERIMENTAL_MODEL:-nvidia/nemotron-3-super-120b-a
# Source shared teardown helper
# shellcheck source=test/e2e/lib/sandbox-teardown.sh
. "${E2E_DIR}/lib/sandbox-teardown.sh"
# shellcheck source=test/e2e/lib/install-path-refresh.sh
. "${E2E_DIR}/lib/install-path-refresh.sh"
register_sandbox_for_teardown "$SANDBOX_NAME"

# ══════════════════════════════════════════════════════════════════════
Expand Down Expand Up @@ -127,14 +129,11 @@ kill "$tail_pid" 2>/dev/null || true
wait "$tail_pid" 2>/dev/null || true

# Source shell profile
if [ -f "$HOME/.bashrc" ]; then
# shellcheck source=/dev/null
source "$HOME/.bashrc" 2>/dev/null || true
fi
nemoclaw_refresh_install_env
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# shellcheck source=/dev/null
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]] && export PATH="$HOME/.local/bin:$PATH"
nemoclaw_ensure_local_bin_on_path

if [ "$install_exit" -ne 0 ]; then
fail "install.sh failed (exit $install_exit)"
Expand Down
11 changes: 4 additions & 7 deletions test/e2e/test-cloud-onboard-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ PUBLIC_INSTALL_CWD="${NEMOCLAW_PUBLIC_INSTALL_CWD:-}"
# Source shared teardown helper
# shellcheck source=test/e2e/lib/sandbox-teardown.sh
. "${E2E_DIR}/lib/sandbox-teardown.sh"
# shellcheck source=test/e2e/lib/install-path-refresh.sh
. "${E2E_DIR}/lib/install-path-refresh.sh"
register_sandbox_for_teardown "$SANDBOX_NAME"

# ══════════════════════════════════════════════════════════════════════
Expand Down Expand Up @@ -202,16 +204,11 @@ else
fi

# Source shell profile to pick up nvm/PATH changes
if [ -f "$HOME/.bashrc" ]; then
# shellcheck source=/dev/null
source "$HOME/.bashrc" 2>/dev/null || true
fi
nemoclaw_refresh_install_env
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
# shellcheck source=/dev/null
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
nemoclaw_ensure_local_bin_on_path

if [ "$install_exit" -eq 0 ]; then
pass "Public install completed (exit 0)"
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/test-credential-migration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ SANDBOX_NAME="${NEMOCLAW_SANDBOX_NAME:-e2e-cred-migration}"
. "$(dirname "${BASH_SOURCE[0]}")/lib/sandbox-teardown.sh"
register_sandbox_for_teardown "$SANDBOX_NAME"

# shellcheck source=test/e2e/lib/install-path-refresh.sh
. "$(dirname "${BASH_SOURCE[0]}")/lib/install-path-refresh.sh"

# ══════════════════════════════════════════════════════════════════
# Phase 0: Prerequisites
# ══════════════════════════════════════════════════════════════════
Expand All @@ -103,6 +106,8 @@ if ! command -v openshell >/dev/null 2>&1; then
fail "install.sh failed; see /tmp/nemoclaw-e2e-install.log"
exit 1
}
# Refresh PATH so install.sh-managed binaries are visible
nemoclaw_refresh_install_env
fi

command -v openshell >/dev/null 2>&1 || {
Expand Down
11 changes: 4 additions & 7 deletions test/e2e/test-deployment-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export NEMOCLAW_E2E_DEFAULT_TIMEOUT=3600
SCRIPT_DIR_TIMEOUT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
# shellcheck source=test/e2e/e2e-timeout.sh
source "${SCRIPT_DIR_TIMEOUT}/e2e-timeout.sh"
# shellcheck source=test/e2e/lib/install-path-refresh.sh
source "${SCRIPT_DIR_TIMEOUT}/lib/install-path-refresh.sh"

# ── Colors ───────────────────────────────────────────────────────────────────
GREEN='\033[0;32m'
Expand Down Expand Up @@ -76,9 +78,7 @@ install_nemoclaw() {
# shellcheck source=/dev/null
. "$NVM_DIR/nvm.sh"
fi
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
nemoclaw_ensure_local_bin_on_path

if command -v nemoclaw >/dev/null 2>&1; then
log "nemoclaw already installed: $(nemoclaw --version 2>/dev/null || echo unknown)"
Expand All @@ -91,10 +91,7 @@ install_nemoclaw() {
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \
bash "$REPO_ROOT/install.sh" --non-interactive --yes-i-accept-third-party-software \
2>&1 | tee -a "$LOG_FILE"
if [ -f "$HOME/.bashrc" ]; then
# shellcheck source=/dev/null
source "$HOME/.bashrc" 2>/dev/null || true
fi
nemoclaw_refresh_install_env
if ! command -v nemoclaw >/dev/null 2>&1; then
log "ERROR: install.sh failed — nemoclaw not found"
exit 1
Expand Down
12 changes: 5 additions & 7 deletions test/e2e/test-diagnostics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,17 @@ skip() {
# ── Resolve repo root ────────────────────────────────────────────────────────
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"

# shellcheck source=test/e2e/lib/install-path-refresh.sh
. "$(dirname "${BASH_SOURCE[0]}")/lib/install-path-refresh.sh"

# ── Install NemoClaw if not present ──────────────────────────────────────────
install_nemoclaw() {
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
if [ -s "$NVM_DIR/nvm.sh" ]; then
# shellcheck source=/dev/null
. "$NVM_DIR/nvm.sh"
fi
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
nemoclaw_ensure_local_bin_on_path

if command -v nemoclaw >/dev/null 2>&1; then
log "nemoclaw already installed: $(nemoclaw --version 2>/dev/null || echo unknown)"
Expand All @@ -102,10 +103,7 @@ install_nemoclaw() {
NEMOCLAW_ACCEPT_THIRD_PARTY_SOFTWARE=1 \
bash "$REPO_ROOT/install.sh" --non-interactive --yes-i-accept-third-party-software \
2>&1 | tee -a "$LOG_FILE"
if [ -f "$HOME/.bashrc" ]; then
# shellcheck source=/dev/null
source "$HOME/.bashrc" 2>/dev/null || true
fi
nemoclaw_refresh_install_env
if ! command -v nemoclaw >/dev/null 2>&1; then
log "ERROR: install.sh failed — nemoclaw not found"
exit 1
Expand Down
11 changes: 4 additions & 7 deletions test/e2e/test-network-policy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export NEMOCLAW_E2E_DEFAULT_TIMEOUT=3600
SCRIPT_DIR_TIMEOUT="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
# shellcheck source=test/e2e/e2e-timeout.sh
source "${SCRIPT_DIR_TIMEOUT}/e2e-timeout.sh"
# shellcheck source=test/e2e/lib/install-path-refresh.sh
source "${SCRIPT_DIR_TIMEOUT}/lib/install-path-refresh.sh"

# ── Config ───────────────────────────────────────────────────────────────────
SANDBOX_NAME="e2e-net-policy"
Expand Down Expand Up @@ -77,9 +79,7 @@ install_nemoclaw() {
# shellcheck source=/dev/null
. "$NVM_DIR/nvm.sh"
fi
if [ -d "$HOME/.local/bin" ] && [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
nemoclaw_ensure_local_bin_on_path

if command -v nemoclaw >/dev/null 2>&1; then
log "nemoclaw already installed: $(nemoclaw --version 2>/dev/null || echo unknown)"
Expand All @@ -93,10 +93,7 @@ install_nemoclaw() {
NEMOCLAW_POLICY_TIER="restricted" \
bash "$REPO_ROOT/install.sh" --non-interactive --yes-i-accept-third-party-software \
2>&1 | tee -a "$LOG_FILE"
if [ -f "$HOME/.bashrc" ]; then
# shellcheck source=/dev/null
source "$HOME/.bashrc" 2>/dev/null || true
fi
nemoclaw_refresh_install_env
if ! command -v nemoclaw >/dev/null 2>&1; then
log "ERROR: install.sh failed — nemoclaw not found"
exit 1
Expand Down
Loading