test: genericise sample fixtures (appuser/appdb, no project names)

This commit is contained in:
2026-08-22 14:59:37 +10:00
parent 49d257cd3b
commit d5186867fb
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -13,8 +13,8 @@ func envFrom(m map[string]string) Getenv {
func TestLoadDefaults(t *testing.T) {
c, err := Load(envFrom(map[string]string{
"WAITFORDB_USER": "sonarr",
"WAITFORDB_DATABASE": "sonarr-main",
"WAITFORDB_USER": "appuser",
"WAITFORDB_DATABASE": "appdb",
"WAITFORDB_HOST": "db",
}))
if err != nil {
+4 -4
View File
@@ -20,12 +20,12 @@ func TestGetRegisteredDrivers(t *testing.T) {
func TestPostgresDSN(t *testing.T) {
cfg := config.Config{
Host: "db.example", Port: "5432", User: "sonarr",
Password: "p@ss/w:rd", Database: "sonarr-main",
Host: "db.example", Port: "5432", User: "appuser",
Password: "p@ss/w:rd", Database: "appdb",
SSLMode: "disable", ConnectTimeout: 5e9,
}
dsn := postgresDSN(cfg)
if !strings.HasPrefix(dsn, "postgres://sonarr:") {
if !strings.HasPrefix(dsn, "postgres://appuser:") {
t.Errorf("unexpected prefix: %s", dsn)
}
// The special-character password must be percent-escaped, not raw.
@@ -41,7 +41,7 @@ func TestPostgresDSN(t *testing.T) {
if !strings.Contains(dsn, "connect_timeout=5") {
t.Errorf("missing connect_timeout: %s", dsn)
}
if !strings.Contains(dsn, "/sonarr-main") {
if !strings.Contains(dsn, "/appdb") {
t.Errorf("missing dbname: %s", dsn)
}
}