@@ -26,6 +26,14 @@ const (
26
26
ngfContainerName = "nginx-gateway"
27
27
)
28
28
29
+ var (
30
+ baseHttpURL = "http://cafe.example.com"
31
+ baseHttpsURL = "https://cafe.example.com"
32
+ teaURL = baseHttpsURL + "/tea"
33
+ coffeeURL = baseHttpURL + "/coffee"
34
+ ngfPodName string
35
+ )
36
+
29
37
// Since checkContainerLogsForErrors may experience interference from previous tests (as explained in the function
30
38
// documentation), this test is recommended to be run separate from other nfr tests.
31
39
var _ = Describe ("Graceful Recovery test" , Ordered , Label ("functional" , "graceful-recovery" ), func () {
@@ -42,11 +50,6 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("functional", "gracefu
42
50
},
43
51
}
44
52
45
- baseHttpURL := "http://cafe.example.com"
46
- baseHttpsURL := "https://cafe.example.com"
47
- teaURL := baseHttpsURL + "/tea"
48
- coffeeURL := baseHttpURL + "/coffee"
49
-
50
53
var ngfPodName string
51
54
52
55
BeforeAll (func () {
@@ -61,6 +64,8 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("functional", "gracefu
61
64
Expect (err ).ToNot (HaveOccurred ())
62
65
Expect (podNames ).To (HaveLen (1 ))
63
66
67
+ startPortForwarding (serviceType , ngfNamespace , podNames )
68
+
64
69
ngfPodName = podNames [0 ]
65
70
if portFwdPort != 0 {
66
71
coffeeURL = fmt .Sprintf ("%s:%d/coffee" , baseHttpURL , portFwdPort )
@@ -115,6 +120,8 @@ func runRecoveryTest(teaURL, coffeeURL, ngfPodName, containerName string, files
115
120
Expect (err ).ToNot (HaveOccurred ())
116
121
}
117
122
123
+ portFwdPort = 0
124
+ close (portForwardStopCh )
118
125
restartContainer (ngfPodName , containerName )
119
126
120
127
if containerName != nginxContainerName {
@@ -127,6 +134,8 @@ func runRecoveryTest(teaURL, coffeeURL, ngfPodName, containerName string, files
127
134
Should (Succeed ())
128
135
}
129
136
137
+ startPortForwarding (serviceType , ngfNamespace , []string {ngfPodName })
138
+
130
139
Eventually (
131
140
func () error {
132
141
return checkForWorkingTraffic (teaURL , coffeeURL )
@@ -359,7 +368,8 @@ func runNodeDebuggerJob(ngfPodName, jobScript string) (*v1.Job, error) {
359
368
len (job .Spec .Template .Spec .Containers ),
360
369
)
361
370
}
362
- job .Spec .Template .Spec .Containers [0 ].Args = []string {jobScript }
371
+ portScript := "kill $(lsof -t -i:10443,10080)"
372
+ job .Spec .Template .Spec .Containers [0 ].Args = []string {jobScript , portScript }
363
373
job .Namespace = ngfNamespace
364
374
365
375
if err = resourceManager .Apply ([]client.Object {job }); err != nil {
0 commit comments