mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 10:01:34 +00:00
fix(e2e): align service account state (#116254)
This commit is contained in:
committed by
GitHub
parent
7df05d5fc0
commit
62cbbcc800
@@ -74,6 +74,8 @@ create_default_service_state() {
|
||||
"$account_home/.local/bin/openclaw-wrapper" \
|
||||
"$account_home/openclaw-wrapper-argv.log"
|
||||
openclaw_test_state_create "$account_home" empty
|
||||
export HOME="$account_home"
|
||||
export USERPROFILE="$account_home"
|
||||
unset OPENCLAW_HOME OPENCLAW_STATE_DIR OPENCLAW_CONFIG_PATH
|
||||
}
|
||||
|
||||
|
||||
@@ -690,6 +690,7 @@ install_baseline() {
|
||||
}
|
||||
|
||||
seed_state() {
|
||||
local account_home=""
|
||||
openclaw_e2e_eval_test_state_from_b64 "${OPENCLAW_TEST_STATE_FUNCTION_B64:?missing OPENCLAW_TEST_STATE_FUNCTION_B64}"
|
||||
if [ "$ROOT_MANAGED_VPS" = "1" ]; then
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
@@ -701,6 +702,17 @@ seed_state() {
|
||||
else
|
||||
openclaw_test_state_create "$STATE_HOME_ROOT" minimal
|
||||
fi
|
||||
if [ "$UPDATE_RESTART_MODE" = "auto-auth" ]; then
|
||||
account_home="$(getent passwd "$(id -u)" | cut -d: -f6)"
|
||||
if [ -z "$account_home" ]; then
|
||||
echo "Could not resolve the current account home" >&2
|
||||
return 1
|
||||
fi
|
||||
export HOME="$account_home"
|
||||
export USERPROFILE="$account_home"
|
||||
export OPENCLAW_STATE_DIR="$account_home/.openclaw"
|
||||
export OPENCLAW_CONFIG_PATH="$OPENCLAW_STATE_DIR/openclaw.json"
|
||||
fi
|
||||
export OPENCLAW_UPGRADE_SURVIVOR_BASELINE_VERSION="$baseline_version"
|
||||
node scripts/e2e/lib/upgrade-survivor/assertions.mjs seed
|
||||
}
|
||||
|
||||
@@ -4390,7 +4390,12 @@ heartbeat_elapsed="\${BASH_REMATCH[1]}"
|
||||
|
||||
expectTextToIncludeAll(scenario, [
|
||||
'command_timeout="${OPENCLAW_DOCKER_DOCTOR_SWITCH_COMMAND_TIMEOUT:-900s}"',
|
||||
'openclaw_test_state_create "$account_home" empty\n unset OPENCLAW_HOME OPENCLAW_STATE_DIR OPENCLAW_CONFIG_PATH',
|
||||
[
|
||||
'openclaw_test_state_create "$account_home" empty',
|
||||
' export HOME="$account_home"',
|
||||
' export USERPROFILE="$account_home"',
|
||||
" unset OPENCLAW_HOME OPENCLAW_STATE_DIR OPENCLAW_CONFIG_PATH",
|
||||
].join("\n"),
|
||||
"create_default_service_state",
|
||||
'openclaw_e2e_maybe_timeout "$command_timeout" bash -c "$install_cmd"',
|
||||
'openclaw_e2e_maybe_timeout "$command_timeout" bash -c "$doctor_cmd"',
|
||||
@@ -4401,9 +4406,28 @@ heartbeat_elapsed="\${BASH_REMATCH[1]}"
|
||||
expect(
|
||||
scenario.match(/unset OPENCLAW_HOME OPENCLAW_STATE_DIR OPENCLAW_CONFIG_PATH/gu),
|
||||
).toHaveLength(1);
|
||||
expect(scenario.match(/export USERPROFILE="\$account_home"/gu)).toHaveLength(1);
|
||||
expect(scenario).not.toMatch(/^\s*if ! timeout "\$command_timeout"/mu);
|
||||
});
|
||||
|
||||
it("uses the account home for upgrade survivor auto-auth state", () => {
|
||||
const runner = readFileSync(UPGRADE_SURVIVOR_RUN_SCRIPT, "utf8");
|
||||
|
||||
expectTextToIncludeAll(runner, [
|
||||
'if [ "$UPDATE_RESTART_MODE" = "auto-auth" ]; then',
|
||||
'account_home="$(getent passwd "$(id -u)" | cut -d: -f6)"',
|
||||
'if [ -z "$account_home" ]; then',
|
||||
'export HOME="$account_home"',
|
||||
'export USERPROFILE="$account_home"',
|
||||
'export OPENCLAW_STATE_DIR="$account_home/.openclaw"',
|
||||
'export OPENCLAW_CONFIG_PATH="$OPENCLAW_STATE_DIR/openclaw.json"',
|
||||
]);
|
||||
|
||||
expect(
|
||||
runner.indexOf('export OPENCLAW_CONFIG_PATH="$OPENCLAW_STATE_DIR/openclaw.json"'),
|
||||
).toBeLessThan(runner.indexOf("node scripts/e2e/lib/upgrade-survivor/assertions.mjs seed"));
|
||||
});
|
||||
|
||||
it("bounds doctor install switch command log diagnostics", () => {
|
||||
const scenario = readFileSync(DOCTOR_SWITCH_SCENARIO_PATH, "utf8");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user