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

signin-throttle.test.ts takes ~58 s alone and times out at 60 s under load #1036

Closed opened this
Closed without merging

scout/forge:scout/864-signin-throttle-test-ts-takes-58-s-alone → main 2 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +17 −5
scripts/gate.ts +1 −5
@@ -54,6 +54,7 @@ export const GATE: readonly string[] = [
5454 "test/sealed-private-work.test.ts",
5555 "test/settings.test.ts",
5656 "test/signins.test.ts",
57 "test/signin-throttle.test.ts",
5758 "test/sole-owner-suspend.test.ts",
5859 "test/standing-every-process.test.ts",
5960 "test/steer.test.ts",
@@ -257,11 +258,6 @@ export const EXCLUDED: readonly Exclusion[] = [
257258 issue: 261,
258259 },
259260 { file: "test/security-xss.test.ts", reason: "not yet admitted", issue: 261 },
260 {
261 file: "test/signin-throttle.test.ts",
262 reason: "not yet admitted",
263 issue: 261,
264 },
265261 {
266262 file: "test/snapshot-destination.test.ts",
267263 reason: "not yet admitted",
test/capacity.test.ts +6
@@ -96,7 +96,12 @@ describe("capacity: only a forge admin reads or changes it", () => {
9696 };
9797 };
9898
99 // The default is the environment's: a check that runs with
100 // FORGE_CHECK_SHARDS set must not change what "back to the default" means.
101 const shardsEnv = process.env.FORGE_CHECK_SHARDS;
102
99103 beforeAll(async () => {
104 delete process.env.FORGE_CHECK_SHARDS;
100105 dataDir = await mkdtemp(join(tmpdir(), "forge-capacity-"));
101106 app = createApp({ dataDir, port: 0 });
102107 servers = await serve(app);
@@ -127,6 +132,7 @@ describe("capacity: only a forge admin reads or changes it", () => {
127132 });
128133
129134 afterAll(async () => {
135 if (shardsEnv !== undefined) process.env.FORGE_CHECK_SHARDS = shardsEnv;
130136 servers.stop();
131137 app.close();
132138 await rm(dataDir, { recursive: true, force: true });
test/signin-throttle.test.ts +10
@@ -36,6 +36,16 @@ describe("sign-in attempts are throttled", () => {
3636 adminIfFirst: true,
3737 });
3838 if (!a.ok) throw new Error(a.error);
39 // Verification reads its cost from the stored hash, so a minimal-cost
40 // hash makes twenty wrong guesses cheap; the throttle is what is tested.
41 const cheap = await Bun.password.hash("a-good-passphrase", {
42 algorithm: "argon2id",
43 memoryCost: 8,
44 timeCost: 1,
45 });
46 app.db
47 .query("UPDATE user SET password_hash = ?1 WHERE username = 'alice'")
48 .run(cheap);
3949 });
4050
4151 afterAll(async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs