hs-test: fix broken test 84/42284/1
authorMatus Fabian <[email protected]>
Thu, 30 Jan 2025 09:36:14 +0000 (04:36 -0500)
committerDave Wallace <[email protected]>
Thu, 30 Jan 2025 17:14:26 +0000 (17:14 +0000)
AssertContains and AssertNotContains are now case insensitive to
prevent issues like in HttpPersistentConnectionTest.

Type: test

Change-Id: Ic52e3fa5a7d1d5cb8486e86aa39a845cbd911d94
Signed-off-by: Matus Fabian <[email protected]>
(cherry picked from commit d38c132883ac6e9f726fed7f5a533288a5932058)

extras/hs-test/infra/hst_suite.go

index 78cabb3..d91958e 100644 (file)
@@ -327,11 +327,11 @@ func (s *HstSuite) AssertNotEqual(expected, actual interface{}, msgAndArgs ...in
 }
 
 func (s *HstSuite) AssertContains(testString, contains interface{}, msgAndArgs ...interface{}) {
-       ExpectWithOffset(2, testString).To(ContainSubstring(fmt.Sprint(contains)), msgAndArgs...)
+       ExpectWithOffset(2, strings.ToLower(fmt.Sprint(testString))).To(ContainSubstring(strings.ToLower(fmt.Sprint(contains))), msgAndArgs...)
 }
 
 func (s *HstSuite) AssertNotContains(testString, contains interface{}, msgAndArgs ...interface{}) {
-       ExpectWithOffset(2, testString).ToNot(ContainSubstring(fmt.Sprint(contains)), msgAndArgs...)
+       ExpectWithOffset(2, strings.ToLower(fmt.Sprint(testString))).ToNot(ContainSubstring(strings.ToLower(fmt.Sprint(contains))), msgAndArgs...)
 }
 
 func (s *HstSuite) AssertEmpty(object interface{}, msgAndArgs ...interface{}) {