Skip to content

Commit efdcd49

Browse files
committed
test: Loosen Helm test for Helm 3.8.0+
Some of the Helm tests expect the default value of `.Release.Name` to appear in expanded output as all-caps "RELEASE-NAME". Starting in Helm 3.8.0, that default was changed to lowercase "release-name", breaking those tests. The tests now match expected output containing the string in a case-insensitive fashion.
1 parent e4a372f commit efdcd49

File tree

2 files changed

+62
-23
lines changed

2 files changed

+62
-23
lines changed

data/data.go

Lines changed: 37 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/helm/helm_test.go

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,31 @@ func TestExpandHelmTemplates(t *testing.T) {
186186
contentsStr := string(contents)
187187

188188
for _, value := range values {
189-
assert.True(
190-
t,
191-
strings.Contains(contentsStr, value),
192-
"file %s for test case %s does not contain %s: %s",
193-
existsSubPath,
194-
testCase.description,
195-
value,
196-
contentsStr,
197-
)
189+
if strings.Contains(value, "RELEASE-NAME") || strings.Contains(value, "release-name") {
190+
// In Helm 3.8.0, the default value for .Release.Name changed from
191+
// uppercase to lowercase
192+
contentsStrUp := strings.ToUpper(contentsStr)
193+
valueUp := strings.ToUpper(value)
194+
assert.True(
195+
t,
196+
strings.Contains(contentsStrUp, valueUp),
197+
"file %s for test case %s does not contain (case-insensitive) %s: %s",
198+
existsSubPath,
199+
testCase.description,
200+
value,
201+
contentsStr,
202+
)
203+
} else {
204+
assert.True(
205+
t,
206+
strings.Contains(contentsStr, value),
207+
"file %s for test case %s does not contain %s: %s",
208+
existsSubPath,
209+
testCase.description,
210+
value,
211+
contentsStr,
212+
)
213+
}
198214
}
199215
}
200216
}

0 commit comments

Comments
 (0)