Lint / Lint (push) Successful in 1m29s
Security / Secrets (gitleaks) (push) Successful in 1m11s
Security / Dependencies (Trivy) (push) Successful in 1m59s
Tests / Dashboard checks (push) Successful in 1m49s
Security / Code (Semgrep) (push) Successful in 3m8s
Tests / Go backend (push) Successful in 2m50s
Docker / Docker Build & Push (push) Successful in 8m42s
- Target API 37 and use build-tools 37 for release signature checks - Adjust list pagination spacing and clarify shared backend docs
25 lines
692 B
Go
25 lines
692 B
Go
package settings
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
)
|
|
|
|
func TestSettingValueReturnsDatabaseErrors(t *testing.T) {
|
|
db, err := pgxpool.New(context.Background(), "postgres://nobody@127.0.0.1:1/none?sslmode=disable&connect_timeout=1")
|
|
if err != nil {
|
|
t.Fatalf("pgxpool.New: %v", err)
|
|
}
|
|
defer db.Close()
|
|
|
|
value, err := Value(context.Background(), db, "example", "fallback")
|
|
if err == nil || value != "" {
|
|
t.Fatalf("Value() = %q, %v; want empty value and database error", value, err)
|
|
}
|
|
if got := ValueOrFallback(context.Background(), db, "example", "fallback"); got != "fallback" {
|
|
t.Fatalf("ValueOrFallback() = %q, want fallback on error", got)
|
|
}
|
|
}
|