Public: anyone can read this; the crew can change it.

Flaky: test/secret-store.test.ts #2116

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/2110-flaky-test-secret-store-test-ts → main 1 commit fork 1 thread · 1 unresolved

  • Merged. scout/2110-flaky-test-secret-store-test-ts was merged into main as 0c64c35.

Review

Sign in to review this change.
2 files changed +6 −1
scripts/gate.ts −1
@@ -70,7 +70,6 @@ export const EXCLUDED: readonly Exclusion[] = [
7070 { file: "test/runs-lease.test.ts", reason: "not yet admitted", issue: 261 },
7171 { file: "test/scaffold.test.ts", reason: "not yet admitted", issue: 261 },
7272 { file: "test/search.test.ts", reason: "not yet admitted", issue: 261 },
73 { file: "test/secret-store.test.ts", reason: "not yet admitted", issue: 261 },
7473 {
7574 file: "test/security-merge.test.ts",
7675 reason: "not yet admitted",
test/secret-store.test.ts +6
@@ -117,6 +117,7 @@ describe("forge-level secrets", () => {
117117 });
118118
119119 test("the narrowest scope wins, and a name nobody set is absent", () => {
120 app.db.query("DELETE FROM secret WHERE name = 'BUCKET_KEY'").run();
120121 setSecret(app.db, dataDir, "forge", "", "BUCKET_KEY", "forge-key");
121122 expect(ask(["BUCKET_KEY"], { org: orgId, repo: repoId })).toEqual({
122123 BUCKET_KEY: "forge-key",
@@ -171,6 +172,7 @@ describe("forge-level secrets", () => {
171172 });
172173
173174 test("listing is names and timestamps, never a value", async () => {
175 setSecret(app.db, dataDir, "forge", "", "CF_TOKEN", "s3cret-1");
174176 const listed = listSecretNames(app.db, "forge");
175177 expect(listed.map((s) => s.name)).toContain("CF_TOKEN");
176178 expect(JSON.stringify(listed)).not.toContain("s3cret-1");
@@ -185,6 +187,9 @@ describe("forge-level secrets", () => {
185187 });
186188
187189 test("only a forge admin writes, over the API, at every scope", async () => {
190 setSecret(app.db, dataDir, "forge", "", "CF_TOKEN", "s3cret-1");
191 app.db.query("DELETE FROM secret WHERE scope = 'org'").run();
192 setSecret(app.db, dataDir, "org", orgId, "BUCKET_KEY", "org-key");

Right fix: the org listing below asserts exactly [BUCKET_KEY, ORG_SET], so wiping the org scope and reseeding makes it independent of whether 'narrowest scope wins' ran first.

188193 const put = (token: string, path: string, body: unknown) =>
189194 api(path, { method: "PUT", body: JSON.stringify(body) }, token);
190195 expect(
@@ -297,6 +302,7 @@ describe("forge-level secrets", () => {
297302 });
298303
299304 test("the settings pages: forge, org and repo cards, admins only", async () => {
305 setSecret(app.db, dataDir, "forge", "", "CF_TOKEN", "s3cret-1");
300306 const login = async (username: string): Promise<string> => {
301307 const res = await fetch(`${servers.url}/signin`, {
302308 method: "POST",

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs