Every test that starts a database hashed the bootstrap admin password with Argon2id at 64 MB, which under -race holds about 150 MB per hash, across dozens of parallel tests. The test packages that hash now lower the memory cost to 1 MB from TestMain. One test still hashes and verifies at the shipped parameters, which are unchanged. script/test also runs at most four packages and eight parallel tests at once: unbounded, a many-core host linked and ran every test binary together. Model: opus-5-5
This commit is contained in:
@@ -45,3 +45,20 @@ func NewTestWebhookDBManagerWithLogger(
|
||||
log: log,
|
||||
}
|
||||
}
|
||||
|
||||
// testArgon2Memory is the Argon2id memory cost, in KiB, that test
|
||||
// binaries hash with: 1 MB instead of the shipped 64 MB.
|
||||
const testArgon2Memory = 1024
|
||||
|
||||
// LowerPasswordHashCostForTest makes HashPassword use a 1 MB Argon2id
|
||||
// memory cost instead of the shipped 64 MB, for the rest of the
|
||||
// process. Call it from TestMain, before any test runs.
|
||||
//
|
||||
// Every test that starts a database hashes the bootstrap admin
|
||||
// password, and a package runs dozens of those tests in parallel.
|
||||
// Under the race detector each 64 MB hash holds about 150 MB resident.
|
||||
// VerifyPassword reads the cost from the hash it checks, so
|
||||
// verification follows. Production code never calls this.
|
||||
func LowerPasswordHashCostForTest() {
|
||||
hashConfig.Memory = testArgon2Memory
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user