ci: expand CI checks and make consumer sync opt-in

- Add Go, npm, Python, and Java validation to CI
- Run Go tests against PostgreSQL
- Record performance fixes in the report
This commit is contained in:
Gabriel20xx committed 2026-10-19 21:14:31 +00:00
1 parent 199a5efaef
commit 22887fef03
100 files changed
+9740 -429

No files matched your search

+28 -1
View File
@@ -1,6 +1,7 @@
package auth
import (
"errors"
"strings"
"testing"
"time"
@@ -19,7 +20,7 @@ func TestPasswordRoundTrip(t *testing.T) {
if VerifyPassword(hash, "wrong password") {
t.Fatal("VerifyPassword() accepted the wrong password")
}
if cost, err := bcrypt.Cost([]byte(hash)); err != nil || cost != BcryptCost {
if cost, err := bcrypt.Cost([]byte(strings.TrimPrefix(hash, bcryptScheme))); err != nil || cost != BcryptCost {
t.Fatalf("bcrypt cost = %d, error = %v; want %d", cost, err, BcryptCost)
}
}
@@ -67,3 +68,29 @@ func TestResetManagerExpiresCode(t *testing.T) {
t.Fatal("Confirm() accepted an expired reset code")
}
}
func TestValidateCredentialsRefusesEmptyHashAndAtUsername(t *testing.T) {
if err := validateCredentials("alice", ""); !errors.Is(err, ErrEmptyPasswordHash) {
t.Fatalf("empty hash error = %v, want ErrEmptyPasswordHash", err)
}
if err := validateCredentials("alice@example.com", "hash"); !errors.Is(err, ErrInvalidUsername) {
t.Fatalf("@ username error = %v, want ErrInvalidUsername", err)
}
if err := validateCredentials("alice", "hash"); err != nil {
t.Fatalf("valid credentials refused: %v", err)
}
}
func TestHashPasswordUsesTheSharedBcryptCost(t *testing.T) {
hash, err := HashPassword("correct horse battery staple")
if err != nil {
t.Fatal(err)
}
cost, err := bcrypt.Cost([]byte(strings.TrimPrefix(hash, bcryptScheme)))
if err != nil {
t.Fatal(err)
}
if cost != BcryptCost {
t.Fatalf("bcrypt cost = %d, want %d", cost, BcryptCost)
}
}