@@ -28,7 +28,7 @@ const (
28
28
29
29
// Since checkContainerLogsForErrors may experience interference from previous tests (as explained in the function
30
30
// documentation), this test is recommended to be run separate from other nfr tests.
31
- var _ = Describe ("Graceful Recovery test" , Ordered , Label ("nfr " , "graceful-recovery" ), func () {
31
+ var _ = Describe ("Graceful Recovery test" , Ordered , Label ("functional " , "graceful-recovery" ), func () {
32
32
files := []string {
33
33
"graceful-recovery/cafe.yaml" ,
34
34
"graceful-recovery/cafe-secret.yaml" ,
@@ -38,8 +38,10 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("nfr", "graceful-recov
38
38
39
39
var ns core.Namespace
40
40
41
- teaURL := "https://cafe.example.com/tea"
42
- coffeeURL := "http://cafe.example.com/coffee"
41
+ baseHTTPURL := "http://cafe.example.com"
42
+ baseHTTPSURL := "https://cafe.example.com"
43
+ teaURL := baseHTTPSURL + "/tea"
44
+ coffeeURL := baseHTTPURL + "/coffee"
43
45
44
46
var ngfPodName string
45
47
@@ -56,6 +58,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("nfr", "graceful-recov
56
58
Expect (podNames ).To (HaveLen (1 ))
57
59
58
60
ngfPodName = podNames [0 ]
61
+ if portFwdPort != 0 {
62
+ coffeeURL = fmt .Sprintf ("%s:%d/coffee" , baseHTTPURL , portFwdPort )
63
+ }
64
+ if portFwdHTTPSPort != 0 {
65
+ teaURL = fmt .Sprintf ("%s:%d/tea" , baseHTTPSURL , portFwdHTTPSPort )
66
+ }
59
67
})
60
68
61
69
BeforeEach (func () {
@@ -67,7 +75,7 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("nfr", "graceful-recov
67
75
68
76
Expect (resourceManager .Apply ([]client.Object {& ns })).To (Succeed ())
69
77
Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
70
- Expect (resourceManager .WaitForAppsToBeReady (ns .Name )).To (Succeed ())
78
+ Expect (resourceManager .WaitForAppsToBeReadyWithPodCount (ns .Name , 2 )).To (Succeed ())
71
79
72
80
Eventually (
73
81
func () error {
@@ -101,7 +109,7 @@ func runRecoveryTest(teaURL, coffeeURL, ngfPodName, containerName string, files
101
109
)
102
110
103
111
if containerName != nginxContainerName {
104
- // Since we have already deployed resources and ran resourceManager.WaitForAppsToBeReady(ns.Name) earlier,
112
+ // Since we have already deployed resources and ran resourceManager.WaitForAppsToBeReadyWithPodCount earlier,
105
113
// we know that the applications are ready at this point. This could only be the case if NGF has written
106
114
// statuses, which could only be the case if NGF has the leader lease. Since there is only one instance
107
115
// of NGF in this test, we can be certain that this is the correct leaseholder name.
@@ -140,7 +148,7 @@ func runRecoveryTest(teaURL, coffeeURL, ngfPodName, containerName string, files
140
148
Should (Succeed ())
141
149
142
150
Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
143
- Expect (resourceManager .WaitForAppsToBeReady (ns .Name )).To (Succeed ())
151
+ Expect (resourceManager .WaitForAppsToBeReadyWithPodCount (ns .Name , 2 )).To (Succeed ())
144
152
145
153
Eventually (
146
154
func () error {
@@ -265,7 +273,11 @@ func checkContainerLogsForErrors(ngfPodName string) {
265
273
Expect (line ).ToNot (ContainSubstring ("[alert]" ), line )
266
274
Expect (line ).ToNot (ContainSubstring ("[emerg]" ), line )
267
275
if strings .Contains (line , "[error]" ) {
268
- Expect (line ).To (ContainSubstring ("connect() failed (111: Connection refused)" ), line )
276
+ expectedError1 := "connect() failed (111: Connection refused)"
277
+ // FIXME(salonichf5) remove this error message check
278
+ // when https://github.com/nginxinc/nginx-gateway-fabric/issues/2090 is completed.
279
+ expectedError2 := "no live upstreams while connecting to upstream"
280
+ Expect (line ).To (Or (ContainSubstring (expectedError1 ), ContainSubstring (expectedError2 )))
269
281
}
270
282
}
271
283
@@ -275,7 +287,14 @@ func checkContainerLogsForErrors(ngfPodName string) {
275
287
& core.PodLogOptions {Container : ngfContainerName },
276
288
)
277
289
Expect (err ).ToNot (HaveOccurred ())
278
- Expect (logs ).ToNot (ContainSubstring ("\" level\" :\" error\" " ), logs )
290
+
291
+ for _ , line := range strings .Split (logs , "\n " ) {
292
+ if * plusEnabled && strings .Contains (line , "\" level\" :\" error\" " ) {
293
+ Expect (line ).To (ContainSubstring ("Usage reporting must be enabled when using NGINX Plus" ), line )
294
+ } else {
295
+ Expect (line ).ToNot (ContainSubstring ("\" level\" :\" error\" " ), line )
296
+ }
297
+ }
279
298
}
280
299
281
300
func checkLeaderLeaseChange (originalLeaseName string ) error {
0 commit comments