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

Full suite red: 2 files in check run 01m7j603sfecehdhmcs96tada3 #14215

Merged opened this in answer to

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

Merged

mason/forge:mason/14214-full-suite-red-2-files-in-check-run-01m7 → main 3 commits fork 2 threads · 2 unresolved

  • Merged. mason/14214-full-suite-red-2-files-in-check-run-01m7 was merged into main as cad1713.

Review

Sign in to review this change.
1 file changed +17 −11
test/quotas-storage.test.ts +17 −11
@@ -15,7 +15,8 @@ import { newApp } from "../src/actions/apps.ts";
1515 import { signUp } from "../src/actions/users.ts";
1616 import { createToken } from "../src/core/tokens.ts";
1717 import { REWALK_MS, accountBytes, formatBytes, storageRefusal } from "../src/core/storage.ts";
18 import { getRepo } from "../src/core/repos.ts";
18 import { getRepo, type Repo } from "../src/core/repos.ts";
19

Non-blocking: this blank line splits the import block and should go.

1920 import { createAgent } from "../src/actions/crew.ts";
2021 import { mirrorAndWait, newFakeState, serveFakeForge } from "./fake-origin.ts";
2122 import { serveGitCommand } from "../src/tui/ssh.ts";
@@ -34,6 +35,8 @@ import { seedAdmin } from "./helpers/admin.ts";
3435 describe("storage quota", () => {
3536 let dataDir: string;
3637 let app: App;
38 /** Public parents the fork test forks in turn, made once in the setup. */
39 let forkParents: Repo[] = [];

Non-blocking: use const, since the array is never reassigned.

3740 let servers: Servers;
3841 let adaId: string;
3942 let adaToken: string;
@@ -84,6 +87,12 @@ describe("storage quota", () => {
8487 // 1 MB limit, on this same forge, pushed once here so neither test pays for it.
8588 expect((await push("ada", adaToken, "bigorigin", 1_100_000)).code).toBe(0);
8689 app.db.query("UPDATE repo SET visibility = 'public' WHERE name = 'bigorigin'").run();
90 for (let i = 0; i < 8; i++) {
91 const parent = await createRepo(app, ada.value, { name: `src${i}`, visibility: "public" });
92 if (!parent.ok) throw new Error(parent.error);
93 await commitToBranch(app, ada.value, parent.value, { message: "seed", files: [{ path: "a.txt", content: "a\n" }] });
94 forkParents.push(parent.value);
95 }
8796 // gina imports it by migrate: let in because her account is empty.
8897 const state = newFakeState("forgejo", "someone", "tok");
8998 state.repos.push({
@@ -228,19 +237,16 @@ describe("storage quota", () => {
228237 const filled = await push("carol", carolToken, "base", 900_000);
229238 expect(filled.code).toBe(0);
230239 const carol = getUserById(app.db, carolId)!;
231 const ada = getUserById(app.db, adaId)!;
232240 let refused: string | undefined;
233241 let made = 0;
234 for (let i = 0; i < 60 && refused === undefined; i++) {
235 const parent = await createRepo(app, ada, { name: `src${i}`, visibility: "public" });
236 if (!parent.ok) throw new Error(parent.error);
237 await commitToBranch(app, ada, parent.value, {
238 message: "seed",
239 files: [{ path: "a.txt", content: "a\n" }],
240 });
241 const forked = await forkRepo(app, carol, parent.value);
242 // The parents were made once, in the setup: only the forks are the test's own work.
243 for (const parent of forkParents) {
244 const forked = await forkRepo(app, carol, parent);
242245 if (forked.ok) made++;
243 else refused = forked.error;
246 else {
247 refused = forked.error;
248 break;
249 }
244250 }
245251 expect(made).toBeGreaterThan(0);
246252 expect(refused).toBe("storage_limit");

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs