@@ -44,34 +44,7 @@ func TestRenderTemplate_WithValidParams(t *testing.T) {
44
44
// will contain:
45
45
// - plaintext value like 'riotkit' as user
46
46
// - not processed '${DB_PASSWORD}' as password
47
- assert .Contains (t , out , "pgbr db backup --password '${DB_PASSWORD}' --user 'riotkit' --db-name 'rkc-test ' --port '5432 '" )
47
+ assert .Contains (t , out , "pgbr db backup --password '${DB_PASSWORD}' --user 'riotkit' --port '5432 ' --host 'postgres.db.svc.cluster.local '" )
48
48
assert .Contains (t , out , "exec backup-maker make" ) // the last command is backup-maker (may change within the template, just like line above)
49
49
assert .Nil (t , err )
50
50
}
51
-
52
- func TestRenderTemplate_FailsWhenAnyVariableIsMissing (t * testing.T ) {
53
- params := map [string ]string {
54
- "hostname" : "postgres.db.svc.cluster.local" ,
55
- "port" : "5432" ,
56
- // NOTICE: a few variables there are missing: db, user, password
57
- }
58
-
59
- repository := map [string ]string {
60
- "url" : "https://example.org" ,
61
- "token" : "${BR_TOKEN}" ,
62
- "encryptionKeyPath" : "/var/lib/backup-repository/encryption.key" ,
63
- "passphrase" : "${GPG_PASSPHRASE}" ,
64
- "recipient" : "your-gpg@email.org" ,
65
- "collectionId" : "111-222-333-444" ,
66
- }
67
-
68
- template := generate.Templating {}
69
- _ , err := template .RenderTemplate ("pg15" , "backup" , map [string ]interface {}{
70
- "Params" : params ,
71
- "Repository" : repository ,
72
- })
73
-
74
- assert .NotNil (t , err )
75
- assert .Contains (t , err .Error (), "pg15" )
76
- assert .Contains (t , err .Error (), "map has no entry for key" )
77
- }
0 commit comments