mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
test: preserve secrets state env snapshot
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
/** Tests secrets runtime state clone isolation and refresh context. */
|
/** Tests secrets runtime state clone isolation and refresh context. */
|
||||||
import { afterEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
import { captureEnv } from "../test-utils/env.js";
|
||||||
import {
|
import {
|
||||||
activateSecretsRuntimeSnapshotState,
|
activateSecretsRuntimeSnapshotState,
|
||||||
clearSecretsRuntimeSnapshot,
|
clearSecretsRuntimeSnapshot,
|
||||||
@@ -9,15 +10,15 @@ import {
|
|||||||
} from "./runtime-state.js";
|
} from "./runtime-state.js";
|
||||||
|
|
||||||
describe("secrets runtime state", () => {
|
describe("secrets runtime state", () => {
|
||||||
const previousStateDir = process.env.OPENCLAW_STATE_DIR;
|
let envSnapshot: ReturnType<typeof captureEnv>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
envSnapshot = captureEnv(["OPENCLAW_STATE_DIR"]);
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
clearSecretsRuntimeSnapshot();
|
clearSecretsRuntimeSnapshot();
|
||||||
if (previousStateDir === undefined) {
|
envSnapshot.restore();
|
||||||
delete process.env.OPENCLAW_STATE_DIR;
|
|
||||||
} else {
|
|
||||||
process.env.OPENCLAW_STATE_DIR = previousStateDir;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("exposes the active config pair for hot paths without requiring the full snapshot", () => {
|
it("exposes the active config pair for hot paths without requiring the full snapshot", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user