@@ -295,7 +295,7 @@ func TestRunVolume(t *testing.T) {
295
295
})
296
296
297
297
t .Run ("http get" , func (t * testing.T ) {
298
- output := HTTPGetWithRetry (t , endpoint , http .StatusOK , 2 * time .Second , 20 * time .Second )
298
+ output := HTTPGetWithRetry (t , endpoint , http .StatusOK , 2 * time .Second , time .Minute )
299
299
assert .Assert (t , strings .Contains (output , testFileContent ), "Actual content: " + output )
300
300
})
301
301
@@ -584,12 +584,12 @@ func TestUpSecretsResources(t *testing.T) {
584
584
assert .Assert (t , is .Len (web1Inspect .Ports , 1 ))
585
585
endpoint := fmt .Sprintf ("http://%s:%d" , web1Inspect .Ports [0 ].HostIP , web1Inspect .Ports [0 ].HostPort )
586
586
587
- output := HTTPGetWithRetry (t , endpoint + "/" + secret1Name , http .StatusOK , 2 * time .Second , 20 * time .Second )
587
+ output := HTTPGetWithRetry (t , endpoint + "/" + secret1Name , http .StatusOK , 2 * time .Second , time .Minute )
588
588
// replace windows carriage return
589
589
output = strings .ReplaceAll (output , "\r " , "" )
590
590
assert .Equal (t , output , secret1Value )
591
591
592
- output = HTTPGetWithRetry (t , endpoint + "/" + secret2Name , http .StatusOK , 2 * time .Second , 20 * time .Second )
592
+ output = HTTPGetWithRetry (t , endpoint + "/" + secret2Name , http .StatusOK , 2 * time .Second , time .Minute )
593
593
output = strings .ReplaceAll (output , "\r " , "" )
594
594
assert .Equal (t , output , secret2Value )
595
595
})
@@ -598,11 +598,11 @@ func TestUpSecretsResources(t *testing.T) {
598
598
assert .Assert (t , is .Len (web2Inspect .Ports , 1 ))
599
599
endpoint := fmt .Sprintf ("http://%s:%d" , web2Inspect .Ports [0 ].HostIP , web2Inspect .Ports [0 ].HostPort )
600
600
601
- output := HTTPGetWithRetry (t , endpoint + "/" + secret2Name , http .StatusOK , 2 * time .Second , 20 * time .Second )
601
+ output := HTTPGetWithRetry (t , endpoint + "/" + secret2Name , http .StatusOK , 2 * time .Second , time .Minute )
602
602
output = strings .ReplaceAll (output , "\r " , "" )
603
603
assert .Equal (t , output , secret2Value )
604
604
605
- HTTPGetWithRetry (t , endpoint + "/" + secret1Name , http .StatusNotFound , 2 * time .Second , 20 * time .Second )
605
+ HTTPGetWithRetry (t , endpoint + "/" + secret1Name , http .StatusNotFound , 2 * time .Second , time .Minute )
606
606
})
607
607
608
608
t .Run ("check resource limits" , func (t * testing.T ) {
@@ -627,7 +627,7 @@ func TestUpSecretsResources(t *testing.T) {
627
627
628
628
t .Run ("healthcheck restart failed app" , func (t * testing.T ) {
629
629
endpoint := fmt .Sprintf ("http://%s:%d" , web1Inspect .Ports [0 ].HostIP , web1Inspect .Ports [0 ].HostPort )
630
- HTTPGetWithRetry (t , endpoint + "/failtestserver" , http .StatusOK , 3 * time .Second , 3 * time .Second )
630
+ HTTPGetWithRetry (t , endpoint + "/failtestserver" , http .StatusOK , 3 * time .Second , time .Minute )
631
631
632
632
logs := c .RunDockerCmd ("logs" , web1 ).Combined ()
633
633
assert .Assert (t , strings .Contains (logs , "GET /healthz" ))
@@ -729,14 +729,14 @@ func TestUpUpdate(t *testing.T) {
729
729
assert .Assert (t , is .Len (containerInspect .Ports , 1 ))
730
730
endpoint := fmt .Sprintf ("http://%s:%d" , containerInspect .Ports [0 ].HostIP , containerInspect .Ports [0 ].HostPort )
731
731
732
- output := HTTPGetWithRetry (t , endpoint + "/words/noun" , http .StatusOK , 2 * time .Second , 20 * time .Second )
732
+ output := HTTPGetWithRetry (t , endpoint + "/words/noun" , http .StatusOK , 2 * time .Second , time .Minute )
733
733
734
734
assert .Assert (t , strings .Contains (output , `"word":` ))
735
735
736
736
endpoint = fmt .Sprintf ("http://%s:%d" , fqdn , containerInspect .Ports [0 ].HostPort )
737
- HTTPGetWithRetry (t , endpoint + "/words/noun" , http .StatusOK , 2 * time .Second , 20 * time .Second )
737
+ HTTPGetWithRetry (t , endpoint + "/words/noun" , http .StatusOK , 2 * time .Second , time .Minute )
738
738
739
- body := HTTPGetWithRetry (t , endpoint + "/volume_test/" + testFileName , http .StatusOK , 2 * time .Second , 20 * time .Second )
739
+ body := HTTPGetWithRetry (t , endpoint + "/volume_test/" + testFileName , http .StatusOK , 2 * time .Second , time .Minute )
740
740
assert .Assert (t , strings .Contains (body , testFileContent ))
741
741
742
742
// Try to remove the volume while it's still in use
@@ -760,17 +760,22 @@ func TestUpUpdate(t *testing.T) {
760
760
for _ , line := range l {
761
761
fields := strings .Fields (line )
762
762
name := fields [0 ]
763
+
763
764
switch name {
764
765
case wordsContainer :
765
766
wordsDisplayed = true
766
- assert .Equal (t , fields [2 ], "Running" )
767
+ assert .Check (t , len (fields ) >= 4 )
768
+ assert .Equal (t , fields [3 ], "Running" , "Got -> %q. All fields -> %#v" , fields [3 ], fields )
767
769
case dbContainer :
768
770
dbDisplayed = true
769
- assert .Equal (t , fields [2 ], "Running" )
771
+ assert .Check (t , len (fields ) >= 4 )
772
+ assert .Equal (t , fields [3 ], "Running" , "Got -> %q. All fields -> %#v" , fields [3 ], fields )
770
773
case serverContainer :
771
774
webDisplayed = true
772
- assert .Equal (t , fields [2 ], "Running" )
773
- assert .Check (t , strings .Contains (fields [3 ], ":80->80/tcp" ))
775
+ assert .Check (t , len (fields ) >= 4 )
776
+ assert .Equal (t , fields [3 ], "Running" , "Got -> %q. All fields -> %#v" , fields [3 ], fields )
777
+ assert .Check (t , len (fields ) >= 5 )
778
+ assert .Check (t , strings .Contains (fields [4 ], ":80->80/tcp" ), "Got -> %q. All fields -> %#v" , fields [4 ], fields )
774
779
}
775
780
}
776
781
assert .Check (t , webDisplayed , "webDisplayed" + res .Stdout ())
0 commit comments