Files
openclaw/src/docs/install-cloud-secrets.test.ts
Peter Steinberger 26312fd0b0 refactor: remove gateway and channel dead exports (#106038)
* refactor: remove gateway and channel dead exports

* style: format config reload test

* refactor: remove newly dead gateway exports

* test: preserve approval audience coverage

* refactor: preserve gateway contracts while pruning exports

* test: retain gateway regression coverage

* test: restore gateway policy coverage

* test: close dead-export CI gaps

* fix: reconcile dead exports with latest main

* refactor: remove newly dead gateway runner export

* test: remove private worker verifier coverage

* test: preserve weak secret docs coverage

* fix: avoid gateway health import cycle

* fix: preserve node pairing type contract

* style: format talk relay test

* fix: preserve gateway protocol generation contract

* chore: refresh dead export baseline

* fix: preserve loaded target compatibility exports

* fix: preserve plugin SDK declaration resolution

* chore: refresh dead export baseline

* chore: refresh dead export baseline

* test(gateway): derive private worker service options
2026-07-13 05:47:05 -07:00

45 lines
1.9 KiB
TypeScript

// Cloud secret install docs tests validate documented cloud secret setup.
import fs from "node:fs/promises";
import path from "node:path";
import { describe, expect, it } from "vitest";
const INSTALL_DOCS_DIR = path.join(process.cwd(), "docs", "install");
const CLOUD_DOCKER_VM_INSTALL_DOCS = new Set(["gcp.md", "hetzner.md"]);
const KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS = [
"change-me-to-a-long-random-token",
"change-me-now",
] as const;
const KNOWN_WEAK_GATEWAY_PASSWORD_PLACEHOLDERS = ["change-me-to-a-strong-password"] as const;
async function readInstallDocs(): Promise<Array<{ docName: string; markdown: string }>> {
const entries = await fs.readdir(INSTALL_DOCS_DIR, { withFileTypes: true });
return await Promise.all(
entries
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
.toSorted((a, b) => a.name.localeCompare(b.name))
.map(async (entry) => ({
docName: entry.name,
markdown: await fs.readFile(path.join(INSTALL_DOCS_DIR, entry.name), "utf8"),
})),
);
}
describe("cloud install docs", () => {
it("does not publish a copy-paste gateway token placeholder", async () => {
for (const { docName, markdown } of await readInstallDocs()) {
for (const token of KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS) {
expect(markdown, docName).not.toContain(`OPENCLAW_GATEWAY_TOKEN=${token}`);
}
for (const password of KNOWN_WEAK_GATEWAY_PASSWORD_PLACEHOLDERS) {
expect(markdown, docName).not.toContain(`OPENCLAW_GATEWAY_PASSWORD=${password}`);
}
expect(markdown, docName).not.toMatch(/^ {4}GOG_KEYRING_PASSWORD=change-me-now$/m);
if (CLOUD_DOCKER_VM_INSTALL_DOCS.has(docName)) {
expect(markdown, docName).toMatch(/^ {4}OPENCLAW_GATEWAY_TOKEN=[ \t]*\r?$/m);
expect(markdown, docName).toMatch(/^ {4}GOG_KEYRING_PASSWORD=[ \t]*\r?$/m);
expect(markdown, docName).toContain("openssl rand -hex 32");
}
}
});
});