Files
openwork/scripts/evals/daytona-e2e-regression.sh

74 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Execute the migrated E2E tests against a real Den stack + Electron inside a
# Daytona eval sandbox (created by .devcontainer/test-on-daytona.sh).
#
# daytona exec <sandbox> -- bash -lc "cd /workspace && bash scripts/evals/daytona-e2e-regression.sh"
#
# Steps: user-space MariaDB (no root in sandboxes), legacy flow baseline through
# the Den stack, then the E2E test lane against the same live stack.
set -euo pipefail
cd /workspace
# Sandbox exec sessions have private /tmp namespaces; the artifacts volume is
# the only log destination visible to other sessions (and over HTTP :8090).
# Default to the workspace so logs are readable from any exec session and over
# the results HTTP server; the artifacts volume restricts cross-session reads.
LOG_DIR="${OPENWORK_E2E_REGRESSION_LOG_DIR:-/workspace/evals/results/e2e-regression}"
mkdir -p "$LOG_DIR"
exec > >(tee "$LOG_DIR/e2e-regression.log") 2>&1
# pnpm must never prompt in a sandbox: an interactive approve-builds/purge
# question kills the run before anything is logged.
export CI=true
export DISPLAY="${DISPLAY:-:99}" # the host component verifies it answers
pnpm --dir evals install
H="$HOME"
MARIADB_VERSION="11.4.5"
if [ ! -x "$H/mariadb/bin/mariadbd" ]; then
echo "==> Installing user-space MariaDB $MARIADB_VERSION"
if [ ! -f /tmp/mariadb.tar.gz ]; then
curl -sfL -o /tmp/mariadb.tar.gz "https://archive.mariadb.org/mariadb-$MARIADB_VERSION/bintar-linux-systemd-x86_64/mariadb-$MARIADB_VERSION-linux-systemd-x86_64.tar.gz"
fi
tar -xzf /tmp/mariadb.tar.gz -C "$H"
rm -rf "$H/mariadb"
mv "$H/mariadb-$MARIADB_VERSION-linux-systemd-x86_64" "$H/mariadb"
fi
export PATH="$H/mariadb/bin:$H/mariadb/scripts:$PATH"
mariadbd --version
# Member bootstrap (invitation flow) needs a way to mark the invited email
# verified; point it at the same native MariaDB the den stack runs on.
cat > "$H/mark-verified.sh" <<'SH'
#!/usr/bin/env bash
set -euo pipefail
email="${1:?email is required}"
escaped_email="${email//\'/\'\'}"
{
printf "SET @openwork_eval_email = '%s';\n" "$escaped_email"
cat <<'SQL'
UPDATE `user` SET email_verified = 1 WHERE email = @openwork_eval_email;
SQL
} | "$HOME/mariadb/bin/mariadb" --protocol=tcp -h 127.0.0.1 -P 3306 -uroot openwork_den
SH
chmod +x "$H/mark-verified.sh"
export OPENWORK_EVAL_MARK_VERIFIED_CMD="bash $H/mark-verified.sh {email}"
# Provider keys for vision validation live on the secrets volume when mounted.
if compgen -G "/daytona-secrets/*.env" > /dev/null; then
set -a
for secret_file in /daytona-secrets/*.env; do . "$secret_file"; done
set +a
echo "==> Sourced provider secrets from /daytona-secrets"
fi
echo "==> E2E regression tests against the same live stack"
export OPENWORK_EVAL_DEN_API_URL="http://127.0.0.1:8790"
export OPENWORK_EVAL_DEN_WEB_URL="http://localhost:3005"
export OPENWORK_EVAL_CDP_URL="http://127.0.0.1:9825"
export OPENWORK_EVAL_E2E_TESTS="1"
pnpm evals:e2e 2>&1 | tee "$LOG_DIR/e2e-tests.log"
echo "==> DONE"