@@ -155,10 +155,7 @@ func TestHostPortStrategyFailsWhileGettingPortDueToOOMKilledContainer(t *testing
155155
156156{
157157err := wg .WaitUntilReady (context .Background (), target )
158- require .Error (t , err )
159-
160- expected := "container crashed with out-of-memory (OOMKilled)"
161- require .Contains (t , err .Error (), expected )
158+ require .ErrorContains (t , err , "container crashed with out-of-memory (OOMKilled)" )
162159}
163160}
164161
@@ -189,10 +186,7 @@ func TestHostPortStrategyFailsWhileGettingPortDueToExitedContainer(t *testing.T)
189186
190187{
191188err := wg .WaitUntilReady (context .Background (), target )
192- require .Error (t , err )
193-
194- expected := "container exited with code 1"
195- require .Contains (t , err .Error (), expected )
189+ require .ErrorContains (t , err , "container exited with code 1" )
196190}
197191}
198192
@@ -222,10 +216,7 @@ func TestHostPortStrategyFailsWhileGettingPortDueToUnexpectedContainerStatus(t *
222216
223217{
224218err := wg .WaitUntilReady (context .Background (), target )
225- require .Error (t , err )
226-
227- expected := "unexpected container status \" dead\" "
228- require .Contains (t , err .Error (), expected )
219+ require .ErrorContains (t , err , "unexpected container status \" dead\" " )
229220}
230221}
231222
@@ -250,10 +241,7 @@ func TestHostPortStrategyFailsWhileExternalCheckingDueToOOMKilledContainer(t *te
250241
251242{
252243err := wg .WaitUntilReady (context .Background (), target )
253- require .Error (t , err )
254-
255- expected := "container crashed with out-of-memory (OOMKilled)"
256- require .Contains (t , err .Error (), expected )
244+ require .ErrorContains (t , err , "container crashed with out-of-memory (OOMKilled)" )
257245}
258246}
259247
@@ -279,10 +267,7 @@ func TestHostPortStrategyFailsWhileExternalCheckingDueToExitedContainer(t *testi
279267
280268{
281269err := wg .WaitUntilReady (context .Background (), target )
282- require .Error (t , err )
283-
284- expected := "container exited with code 1"
285- require .Contains (t , err .Error (), expected )
270+ require .ErrorContains (t , err , "container exited with code 1" )
286271}
287272}
288273
@@ -307,10 +292,7 @@ func TestHostPortStrategyFailsWhileExternalCheckingDueToUnexpectedContainerStatu
307292
308293{
309294err := wg .WaitUntilReady (context .Background (), target )
310- require .Error (t , err )
311-
312- expected := "unexpected container status \" dead\" "
313- require .Contains (t , err .Error (), expected )
295+ require .ErrorContains (t , err , "unexpected container status \" dead\" " )
314296}
315297}
316298
@@ -354,10 +336,7 @@ func TestHostPortStrategyFailsWhileInternalCheckingDueToOOMKilledContainer(t *te
354336
355337{
356338err := wg .WaitUntilReady (context .Background (), target )
357- require .Error (t , err )
358-
359- expected := "container crashed with out-of-memory (OOMKilled)"
360- require .Contains (t , err .Error (), expected )
339+ require .ErrorContains (t , err , "container crashed with out-of-memory (OOMKilled)" )
361340}
362341}
363342
@@ -402,10 +381,7 @@ func TestHostPortStrategyFailsWhileInternalCheckingDueToExitedContainer(t *testi
402381
403382{
404383err := wg .WaitUntilReady (context .Background (), target )
405- require .Error (t , err )
406-
407- expected := "container exited with code 1"
408- require .Contains (t , err .Error (), expected )
384+ require .ErrorContains (t , err , "container exited with code 1" )
409385}
410386}
411387
@@ -449,10 +425,7 @@ func TestHostPortStrategyFailsWhileInternalCheckingDueToUnexpectedContainerStatu
449425
450426{
451427err := wg .WaitUntilReady (context .Background (), target )
452- require .Error (t , err )
453-
454- expected := "unexpected container status \" dead\" "
455- require .Contains (t , err .Error (), expected )
428+ require .ErrorContains (t , err , "unexpected container status \" dead\" " )
456429}
457430}
458431
0 commit comments