@@ -123,11 +123,7 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
123
123
close (portForwardStopCh )
124
124
}
125
125
126
- // drain node
127
-
128
126
if drain {
129
-
130
- fmt .Printf ("about to drain + %s" , time .Now ())
131
127
_ , err := exec .Command (
132
128
"kubectl" ,
133
129
"drain" ,
@@ -139,10 +135,6 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
139
135
Expect (err ).ToNot (HaveOccurred ())
140
136
}
141
137
142
- fmt .Printf ("just drained + %s" , time .Now ())
143
-
144
- // delete node
145
-
146
138
_ , err = exec .Command (
147
139
"kubectl" ,
148
140
"delete" ,
@@ -152,10 +144,7 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
152
144
if err != nil {
153
145
Expect (err ).ToNot (HaveOccurred ())
154
146
}
155
-
156
- fmt .Printf ("just deleted! + %s" , time .Now ())
157
147
}
158
- // restart docker container
159
148
160
149
output , err := exec .Command (
161
150
"docker" ,
@@ -169,7 +158,6 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
169
158
fmt .Println (string (output ))
170
159
171
160
var containerName string
172
-
173
161
for _ , line := range strings .Split (string (output ), "\n " ) {
174
162
for _ , word := range strings .Split (line , " " ) {
175
163
if strings .Contains (word , "control-plane" ) {
@@ -179,21 +167,11 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
179
167
}
180
168
}
181
169
170
+ Expect (containerName ).ToNot (Equal ("" ))
171
+
182
172
// really jank - get the string that contains "control-plane"
183
173
fmt .Println ("This is our container name: " + containerName )
184
174
185
- output , err = exec .Command (
186
- "docker" ,
187
- "container" ,
188
- "inspect" ,
189
- containerName ,
190
- ).CombinedOutput ()
191
- if err != nil {
192
- fmt .Println (fmt .Sprint (err .Error ()))
193
- Expect (err ).ToNot (HaveOccurred ())
194
- }
195
- fmt .Println (string (output ))
196
-
197
175
_ , err = exec .Command (
198
176
"docker" ,
199
177
"restart" ,
@@ -203,26 +181,37 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
203
181
fmt .Println (fmt .Sprint (err .Error ()))
204
182
Expect (err ).ToNot (HaveOccurred ())
205
183
}
206
- fmt .Printf ("just restarted! + %s" , time .Now ())
207
184
208
- time .Sleep (time .Second * 10 )
185
+ Eventually (
186
+ func () bool {
187
+ output , err = exec .Command (
188
+ "docker" ,
189
+ "container" ,
190
+ "inspect" ,
191
+ containerName ,
192
+ ).CombinedOutput ()
193
+ return strings .Contains (string (output ), "\" Running\" : true" ) && err == nil
194
+ }).
195
+ WithTimeout (timeoutConfig .CreateTimeout ).
196
+ WithPolling (500 * time .Millisecond ).
197
+ Should (BeTrue ())
209
198
199
+ var podNames []string
210
200
Eventually (
211
201
func () bool {
212
- podNames , err : = framework .GetReadyNGFPodNames (k8sClient , ngfNamespace , releaseName , timeoutConfig .GetTimeout )
202
+ podNames , err = framework .GetReadyNGFPodNames (k8sClient , ngfNamespace , releaseName , timeoutConfig .GetStatusTimeout )
213
203
return len (podNames ) == 1 && err == nil
214
204
}).
215
205
WithTimeout (timeoutConfig .CreateTimeout ).
216
206
WithPolling (500 * time .Millisecond ).
217
207
Should (BeTrue ())
218
-
219
- podNames , _ := framework .GetReadyNGFPodNames (k8sClient , ngfNamespace , releaseName , timeoutConfig .CreateTimeout )
220
208
ngfPodName := podNames [0 ]
209
+ Expect (ngfPodName ).ToNot (Equal ("" ))
221
210
222
211
if portFwdPort != 0 {
223
212
ports := []string {fmt .Sprintf ("%d:80" , ngfHTTPForwardedPort ), fmt .Sprintf ("%d:443" , ngfHTTPSForwardedPort )}
224
213
portForwardStopCh = make (chan struct {})
225
- err = framework .PortForward (ctlr .GetConfigOrDie (), ngfNamespace , podNames [ 0 ] , ports , portForwardStopCh )
214
+ err = framework .PortForward (ctlr .GetConfigOrDie (), ngfNamespace , ngfPodName , ports , portForwardStopCh )
226
215
address = "127.0.0.1"
227
216
portFwdPort = ngfHTTPForwardedPort
228
217
portFwdHTTPSPort = ngfHTTPSForwardedPort
0 commit comments