release / web (push) Successful in 1m33s
release / go (push) Successful in 1m57s
release / govulncheck (push) Successful in 21s
release / integration (push) Successful in 2m53s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Publish the release image to GHCR (dispatch only) (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / android (push) Canceled after 3m32s
release / Build signed APK (push) Canceled after 3m3s
Run 11288 failed every named test it reached. The api TestMain's cost
check exited the test binary, and the integration lane runs each package's
binary once with no tests to warm the build, so it stopped the lane there
before coverart's database tests ran. The check is now a test of its own:
a weakened cost fails one test and the rest of the lane still runs.
This reverts commit e717e4370d.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
768 B
Go
27 lines
768 B
Go
package api
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"golang.org/x/crypto/bcrypt"
|
|
)
|
|
|
|
// serverPasswordCost is the cost the server hashes stored passwords at,
|
|
// taken before TestMain lowers it.
|
|
var serverPasswordCost = passwordCost
|
|
|
|
// The tests hash passwords at bcrypt's lowest cost: what they check is which
|
|
// password is stored and who is signed out, not how slow a guess is.
|
|
func TestMain(m *testing.M) {
|
|
passwordCost = bcrypt.MinCost
|
|
os.Exit(m.Run())
|
|
}
|
|
|
|
// Lowering the cost for the tests must not hide a weaker one in the server.
|
|
func TestPasswordCost_StoredPasswordsUseAtLeastBcryptsDefault(t *testing.T) {
|
|
if serverPasswordCost < bcrypt.DefaultCost {
|
|
t.Errorf("passwords are stored at bcrypt cost %d, want at least %d", serverPasswordCost, bcrypt.DefaultCost)
|
|
}
|
|
}
|