test: genericise sample fixtures (appuser/appdb, no project names)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user