Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 9e96b96

Browse files
author
B&R
committed
fix
1 parent da1a601 commit 9e96b96

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

generate/templating_test.go

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,34 +44,7 @@ func TestRenderTemplate_WithValidParams(t *testing.T) {
4444
// will contain:
4545
// - plaintext value like 'riotkit' as user
4646
// - 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'")
4848
assert.Contains(t, out, "exec backup-maker make") // the last command is backup-maker (may change within the template, just like line above)
4949
assert.Nil(t, err)
5050
}
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

Comments
 (0)