源码快照 @ 2026-09-02 (source-only, 剔除非源码素材)
This commit is contained in:
Executable
+73
@@ -0,0 +1,73 @@
|
||||
#!/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"
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
# Run ONE E2E test inside a Daytona sandbox, with the environment app tests need.
|
||||
#
|
||||
# daytona exec <sandbox> -- bash -lc "cd /workspace && bash scripts/evals/daytona-e2e-test.sh specs/app-den-tls-fault.e2e.test.ts"
|
||||
#
|
||||
# Logs land in the workspace so they are readable from any exec session and over
|
||||
# the results HTTP server.
|
||||
set -euo pipefail
|
||||
cd /workspace
|
||||
|
||||
TEST="${1:?E2E test path relative to evals/ is required}"
|
||||
LOG_DIR="${OPENWORK_E2E_TEST_LOG_DIR:-/workspace/evals/results/e2e-test-run}"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG="$LOG_DIR/$(printf '%s' "$TEST" | tr '/' '-').log"
|
||||
exec > >(tee "$LOG") 2>&1
|
||||
|
||||
export CI=true
|
||||
export DISPLAY="${DISPLAY:-:99}" # the host component verifies it answers
|
||||
export OPENWORK_EVAL_E2E_TESTS=1
|
||||
if [ -x "$HOME/mark-verified.sh" ]; then
|
||||
export OPENWORK_EVAL_MARK_VERIFIED_CMD="bash $HOME/mark-verified.sh {email}"
|
||||
fi
|
||||
|
||||
if compgen -G "/daytona-secrets/*.env" > /dev/null; then
|
||||
set -a
|
||||
for secret_file in /daytona-secrets/*.env; do . "$secret_file"; done
|
||||
set +a
|
||||
fi
|
||||
|
||||
|
||||
# Den-dependent tests need the stack up. ensureDenStack is idempotent, so this is
|
||||
# safe to call repeatedly; it is skipped unless a test asks for it.
|
||||
if [ "${OPENWORK_E2E_TEST_NEEDS_DEN:-0}" = "1" ]; then
|
||||
echo "==> Ensuring the Den stack is running"
|
||||
export PATH="$HOME/mariadb/bin:$HOME/mariadb/scripts:$PATH"
|
||||
node --input-type=module -e 'const m = await import("/workspace/evals/packages/hosts/src/den-stack.ts"); await m.ensureDenStack({ log: (line) => console.log(" " + line), cdpCandidates: [], skipApp: true });'
|
||||
fi
|
||||
|
||||
# Den env is only exported when a Den actually answers. Exporting it blindly
|
||||
# makes Den-gated tests run against nothing and fail with "fetch failed"
|
||||
# instead of skipping with their own honest reason.
|
||||
DEN_API_CANDIDATE="${OPENWORK_EVAL_DEN_API_URL:-http://127.0.0.1:8790}"
|
||||
if curl -sf -m 3 -o /dev/null "$DEN_API_CANDIDATE/health"; then
|
||||
export OPENWORK_EVAL_DEN_API_URL="$DEN_API_CANDIDATE"
|
||||
export OPENWORK_EVAL_DEN_WEB_URL="${OPENWORK_EVAL_DEN_WEB_URL:-http://localhost:3005}"
|
||||
echo "==> Den answers at $OPENWORK_EVAL_DEN_API_URL"
|
||||
else
|
||||
unset OPENWORK_EVAL_DEN_API_URL OPENWORK_EVAL_DEN_WEB_URL
|
||||
echo "==> No Den running; Den-gated tests will skip (set OPENWORK_E2E_TEST_NEEDS_DEN=1 to start one)"
|
||||
fi
|
||||
|
||||
pnpm --dir evals install
|
||||
echo "==> Running E2E test $TEST"
|
||||
pnpm --dir evals exec vitest run --config vitest.config.ts --project e2e "$TEST"
|
||||
Reference in New Issue
Block a user