Skip to content

Commit 334f575

Browse files
will4jchengfang
authored andcommitted
test: compare content of helm values without image-name annotation
Signed-off-by: William Wang <[email protected]>
1 parent 80ceba2 commit 334f575

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

pkg/argocd/update_test.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,7 +1996,7 @@ replicas: 1
19961996
Parameters: []v1alpha1.HelmParameter{
19971997
{
19981998
Name: "image.name",
1999-
Value: "nginx",
1999+
Value: "nginx-other",
20002000
ForceString: true,
20012001
},
20022002
{
@@ -2018,9 +2018,22 @@ replicas: 1
20182018
},
20192019
}
20202020

2021-
originalData := []byte(`random: yaml`)
2022-
_, err := marshalParamsOverride(&app, originalData)
2021+
originalData := []byte(`
2022+
image:
2023+
registry: docker.io
2024+
repository: nginx
2025+
tag: v0.0.0
2026+
`)
2027+
expected := `
2028+
image:
2029+
registry: docker.io
2030+
repository: nginx
2031+
tag: v1.0.0
2032+
`
2033+
yaml, err := marshalParamsOverride(&app, originalData)
20232034
assert.NoError(t, err)
2035+
assert.NotEmpty(t, yaml)
2036+
assert.Equal(t, strings.TrimSpace(strings.ReplaceAll(expected, "\t", " ")), strings.TrimSpace(string(yaml)))
20242037
})
20252038

20262039
t.Run("Image-name annotation value not found in Helm source parameters list", func(t *testing.T) {

0 commit comments

Comments
 (0)