From 1e90abeb1f7333264abae1b1344ef6b9008b8ebc Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Thu, 19 Jan 2023 16:24:25 +0300 Subject: [PATCH] Add a test-case for config.GetExternalNameFromTemplated where the external-name template variable is not available Signed-off-by: Alper Rifat Ulucinar --- pkg/config/externalname_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/config/externalname_test.go b/pkg/config/externalname_test.go index 87db991e..54d86a56 100644 --- a/pkg/config/externalname_test.go +++ b/pkg/config/externalname_test.go @@ -79,6 +79,16 @@ func TestGetExternalNameFromTemplated(t *testing.T) { name: "myname", }, }, + "NoExternalNameInTemplate": { + reason: "Should return the ID intact if there's no {{ .external_name }} variable in the template", + args: args{ + tmpl: "olala:{{ .another }}:omama:{{ .someOther }}", + val: "olala:val1:omama:val2", + }, + want: want{ + name: "olala:val1:omama:val2", + }, + }, } for name, tc := range cases { t.Run(name, func(t *testing.T) {