@@ -17,7 +17,6 @@ import (
17
17
core "k8s.io/api/core/v1"
18
18
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19
19
"k8s.io/apimachinery/pkg/types"
20
- ctlr "sigs.k8s.io/controller-runtime"
21
20
"sigs.k8s.io/controller-runtime/pkg/client"
22
21
"sigs.k8s.io/yaml"
23
22
@@ -46,7 +45,7 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
46
45
teaURL := baseHTTPSURL + "/tea"
47
46
coffeeURL := baseHTTPURL + "/coffee"
48
47
49
- var ngfPodName string
48
+ // var ngfPodName string
50
49
51
50
BeforeEach (func () {
52
51
// this test is unique in that it will check the entire log of both ngf and nginx containers
@@ -61,7 +60,7 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
61
60
Expect (err ).ToNot (HaveOccurred ())
62
61
Expect (podNames ).To (HaveLen (1 ))
63
62
64
- ngfPodName = podNames [0 ]
63
+ // ngfPodName = podNames[0]
65
64
if portFwdPort != 0 {
66
65
coffeeURL = fmt .Sprintf ("%s:%d/coffee" , baseHTTPURL , portFwdPort )
67
66
}
@@ -79,6 +78,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
79
78
Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
80
79
Expect (resourceManager .WaitForAppsToBeReadyWithPodCount (ns .Name , 2 )).To (Succeed ())
81
80
81
+ nginxPodNames , err := framework .GetReadyNginxPodNames (k8sClient , ns .Name , timeoutConfig .GetTimeout )
82
+ Expect (err ).ToNot (HaveOccurred ())
83
+ Expect (nginxPodNames ).To (HaveLen (1 ))
84
+
85
+ setUpPortForward (nginxPodNames [0 ], ns .Name )
86
+
82
87
Eventually (
83
88
func () error {
84
89
return checkForWorkingTraffic (teaURL , coffeeURL )
@@ -89,17 +94,19 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
89
94
})
90
95
91
96
AfterAll (func () {
97
+ cleanUpPortForward ()
98
+
92
99
Expect (resourceManager .DeleteFromFiles (files , ns .Name )).To (Succeed ())
93
100
Expect (resourceManager .DeleteNamespace (ns .Name )).To (Succeed ())
94
101
})
95
102
96
- It ("recovers when NGF container is restarted" , func () {
97
- runRecoveryTest (teaURL , coffeeURL , ngfPodName , ngfContainerName , files , & ns )
98
- })
99
-
100
- It ("recovers when nginx container is restarted" , func () {
101
- runRecoveryTest (teaURL , coffeeURL , ngfPodName , nginxContainerName , files , & ns )
102
- })
103
+ // It("recovers when NGF container is restarted", func() {
104
+ // runRecoveryTest(teaURL, coffeeURL, ngfPodName, ngfContainerName, files, &ns)
105
+ // })
106
+ //
107
+ // It("recovers when nginx container is restarted", func() {
108
+ // runRecoveryTest(teaURL, coffeeURL, ngfPodName, nginxContainerName, files, &ns)
109
+ // })
103
110
104
111
It ("recovers when drained node is restarted" , func () {
105
112
runRestartNodeWithDrainingTest (teaURL , coffeeURL , files , & ns )
@@ -129,9 +136,7 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
129
136
Expect (* clusterName ).ToNot (BeEmpty ())
130
137
containerName := * clusterName + "-control-plane"
131
138
132
- if portFwdPort != 0 {
133
- close (portForwardStopCh )
134
- }
139
+ cleanUpPortForward ()
135
140
136
141
if drain {
137
142
output , err := exec .Command (
@@ -182,12 +187,19 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
182
187
ngfPodName := podNames [0 ]
183
188
Expect (ngfPodName ).ToNot (BeEmpty ())
184
189
185
- if portFwdPort != 0 {
186
- ports := []string {fmt .Sprintf ("%d:80" , ngfHTTPForwardedPort ), fmt .Sprintf ("%d:443" , ngfHTTPSForwardedPort )}
187
- portForwardStopCh = make (chan struct {})
188
- err = framework .PortForward (ctlr .GetConfigOrDie (), ngfNamespace , ngfPodName , ports , portForwardStopCh )
189
- Expect (err ).ToNot (HaveOccurred ())
190
- }
190
+ var nginxPodNames []string
191
+ Eventually (
192
+ func () bool {
193
+ nginxPodNames , err = framework .GetReadyNginxPodNames (k8sClient , ns .Name , timeoutConfig .GetTimeout )
194
+ return len (nginxPodNames ) == 1 && err == nil
195
+ }).
196
+ WithTimeout (timeoutConfig .CreateTimeout * 2 ).
197
+ WithPolling (500 * time .Millisecond ).
198
+ MustPassRepeatedly (5 ).
199
+ Should (BeTrue ())
200
+
201
+ nginxPodName := nginxPodNames [0 ]
202
+ Expect (nginxPodName ).ToNot (BeEmpty ())
191
203
192
204
checkNGFFunctionality (teaURL , coffeeURL , ngfPodName , "" , files , ns )
193
205
if errorLogs := getUnexpectedNginxErrorLogs (ngfPodName ); errorLogs != "" {
@@ -346,6 +358,12 @@ func checkNGFFunctionality(teaURL, coffeeURL, ngfPodName, containerName string,
346
358
Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
347
359
Expect (resourceManager .WaitForAppsToBeReadyWithPodCount (ns .Name , 2 )).To (Succeed ())
348
360
361
+ nginxPodNames , err := framework .GetReadyNginxPodNames (k8sClient , ns .Name , timeoutConfig .GetTimeout )
362
+ Expect (err ).ToNot (HaveOccurred ())
363
+ Expect (nginxPodNames ).To (HaveLen (1 ))
364
+
365
+ setUpPortForward (nginxPodNames [0 ], ns .Name )
366
+
349
367
Eventually (
350
368
func () error {
351
369
return checkForWorkingTraffic (teaURL , coffeeURL )
0 commit comments