Skip to content

Commit 76c4722

Browse files
committed
Running functional pipeline
1 parent b9077a0 commit 76c4722

File tree

1 file changed

+19
-30
lines changed

1 file changed

+19
-30
lines changed

tests/suite/graceful_recovery_test.go

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
123123
close(portForwardStopCh)
124124
}
125125

126-
// drain node
127-
128126
if drain {
129-
130-
fmt.Printf("about to drain + %s", time.Now())
131127
_, err := exec.Command(
132128
"kubectl",
133129
"drain",
@@ -139,10 +135,6 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
139135
Expect(err).ToNot(HaveOccurred())
140136
}
141137

142-
fmt.Printf("just drained + %s", time.Now())
143-
144-
// delete node
145-
146138
_, err = exec.Command(
147139
"kubectl",
148140
"delete",
@@ -152,10 +144,7 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
152144
if err != nil {
153145
Expect(err).ToNot(HaveOccurred())
154146
}
155-
156-
fmt.Printf("just deleted! + %s", time.Now())
157147
}
158-
// restart docker container
159148

160149
output, err := exec.Command(
161150
"docker",
@@ -169,7 +158,6 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
169158
fmt.Println(string(output))
170159

171160
var containerName string
172-
173161
for _, line := range strings.Split(string(output), "\n") {
174162
for _, word := range strings.Split(line, " ") {
175163
if strings.Contains(word, "control-plane") {
@@ -179,21 +167,11 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
179167
}
180168
}
181169

170+
Expect(containerName).ToNot(Equal(""))
171+
182172
// really jank - get the string that contains "control-plane"
183173
fmt.Println("This is our container name: " + containerName)
184174

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-
197175
_, err = exec.Command(
198176
"docker",
199177
"restart",
@@ -203,26 +181,37 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
203181
fmt.Println(fmt.Sprint(err.Error()))
204182
Expect(err).ToNot(HaveOccurred())
205183
}
206-
fmt.Printf("just restarted! + %s", time.Now())
207184

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())
209198

199+
var podNames []string
210200
Eventually(
211201
func() bool {
212-
podNames, err := framework.GetReadyNGFPodNames(k8sClient, ngfNamespace, releaseName, timeoutConfig.GetTimeout)
202+
podNames, err = framework.GetReadyNGFPodNames(k8sClient, ngfNamespace, releaseName, timeoutConfig.GetStatusTimeout)
213203
return len(podNames) == 1 && err == nil
214204
}).
215205
WithTimeout(timeoutConfig.CreateTimeout).
216206
WithPolling(500 * time.Millisecond).
217207
Should(BeTrue())
218-
219-
podNames, _ := framework.GetReadyNGFPodNames(k8sClient, ngfNamespace, releaseName, timeoutConfig.CreateTimeout)
220208
ngfPodName := podNames[0]
209+
Expect(ngfPodName).ToNot(Equal(""))
221210

222211
if portFwdPort != 0 {
223212
ports := []string{fmt.Sprintf("%d:80", ngfHTTPForwardedPort), fmt.Sprintf("%d:443", ngfHTTPSForwardedPort)}
224213
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)
226215
address = "127.0.0.1"
227216
portFwdPort = ngfHTTPForwardedPort
228217
portFwdHTTPSPort = ngfHTTPSForwardedPort

0 commit comments

Comments
 (0)