Skip to content

Commit 8ce4fea

Browse files
test: change value used for testing url&base64-encoded placeholders, add comments
1 parent 8b77e7c commit 8ce4fea

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/kube/util_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ func TestGenericReplacement_specificPathWithValidation(t *testing.T) {
196196
}
197197

198198
func TestGenericReplacement_specificPathUrlEncoded(t *testing.T) {
199-
// Test that the specific-path placeholder syntax is used to find/replace placeholders that were url-encoded
200-
// along with the generic syntax, since the generic Vault path is defined
199+
// Test that the generic replacement function can find/replace placeholders that were url-encoded
201200
mv := helpers.MockVault{}
202201
mv.LoadData(map[string]interface{}{
203202
"namespace": "default ns",
@@ -240,8 +239,7 @@ func TestGenericReplacement_specificPathUrlEncoded(t *testing.T) {
240239
}
241240

242241
func TestGenericReplacement_specificPathUrlEncodedWithValidation(t *testing.T) {
243-
// Test that the specific-path placeholder syntax is used to find/replace placeholders
244-
// along with the generic syntax, since the generic Vault path is defined
242+
// Test that the generic replacement function can find/replace placeholders that were url-encoded
245243
mv := helpers.MockVault{}
246244
mv.LoadData(map[string]interface{}{
247245
"namespace": "default ns",
@@ -444,6 +442,7 @@ func TestGenericReplacement_multiString(t *testing.T) {
444442
}
445443

446444
func TestGenericReplacement_multiStringSpecificPathUrlEncoded(t *testing.T) {
445+
// Test that multiple url-encoded placeholders in one value string can all be found/replaced.
447446
mv := helpers.MockVault{}
448447
mv.LoadData(map[string]interface{}{
449448
"name": "my app",
@@ -495,7 +494,7 @@ func TestSecretReplacement_SpecificPathUrlEncoded_Base64Encoded(t *testing.T) {
495494

496495
dummyResource := Resource{
497496
TemplateData: map[string]interface{}{
498-
"url": `JTNDcGF0aCUzQWJsYWglMkZibGFoJTIzdXNlcm5hbWUlM0U6Ly86JTNDcGF0aCUzQWJsYWglMkZibGFoJTIzcGFzc3dvcmQlM0VAcmVkaXMtbWFzdGVyLmhhcmJvci5zdmMuY2x1c3Rlci5sb2NhbC8wP2lkbGVfdGltZW91dF9zZWNvbmRzPTMwCg==`,
497+
"url": `cmVkaXM6Ly8lM0NwYXRoJTNBYmxhaCUyRmJsYWglMjN1c2VybmFtZSUzRTolM0NwYXRoJTNBYmxhaCUyRmJsYWglMjNwYXNzd29yZCUzRUByZWRpcy1tYXN0ZXIuaGFyYm9yLnN2Yy5jbHVzdGVyLmxvY2FsLzA/aWRsZV90aW1lb3V0X3NlY29uZHM9MzAK`,
499498
},
500499
Data: map[string]interface{}{
501500
"password": "test",
@@ -511,7 +510,7 @@ func TestSecretReplacement_SpecificPathUrlEncoded_Base64Encoded(t *testing.T) {
511510

512511
expected := Resource{
513512
TemplateData: map[string]interface{}{
514-
"url": "cmVkaXM6Ly86cmVkaXMlNDAxMjNAcmVkaXMtbWFzdGVyLmhhcmJvci5zdmMuY2x1c3Rlci5sb2NhbC8wP2lkbGVfdGltZW91dF9zZWNvbmRzPTMwCg==",
513+
"url": "cmVkaXM6Ly9yZWRpczpyZWRpcyU0MDEyM0ByZWRpcy1tYXN0ZXIuaGFyYm9yLnN2Yy5jbHVzdGVyLmxvY2FsLzA/aWRsZV90aW1lb3V0X3NlY29uZHM9MzAK",
515514
},
516515
Data: map[string]interface{}{
517516
"password": "test",

0 commit comments

Comments
 (0)