Skip to content

Commit 2f57b56

Browse files
committed
add unit test for template-based naming
On-behalf-of: @SAP [email protected]
1 parent fa055bd commit 2f57b56

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/sync/templating/naming_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ func TestGenerateLocalObjectName(t *testing.T) {
8686
namingConfig: &syncagentv1alpha1.ResourceNaming{Name: "foobar-$remoteName"},
8787
expected: types.NamespacedName{Namespace: "testcluster", Name: "foobar-objname"},
8888
},
89+
{
90+
name: "Go templates",
91+
clusterName: "testcluster",
92+
clusterPath: "root:test:team",
93+
remoteObject: createNewObject("objname", "objnamespace"),
94+
namingConfig: &syncagentv1alpha1.ResourceNaming{Name: "{{ .ClusterPath }}-{{ .Object.metadata.name }}"},
95+
expected: types.NamespacedName{Namespace: "testcluster", Name: "root:test:team-objname"},
96+
},
8997
}
9098

9199
for _, testcase := range testcases {

0 commit comments

Comments
 (0)