Skip to content

Commit 5f15e1a

Browse files
authored
Fix the plugin e2e test setup (#2184)
1 parent 40b1fbc commit 5f15e1a

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

e2e/fixtures/factory.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,14 @@ func (factory *Factory) Shutdown() {
309309
time.Sleep(15 * time.Second)
310310
err := factory.CleanupChaosMeshExperiments()
311311
if err != nil {
312-
return
312+
log.Println("Could not delete chaos mesh experiments", err.Error())
313313
}
314314

315+
log.Println("Calling", len(factory.invariantShutdownHooks.handlers), "invariantShutdownHooks")
315316
factory.invariantShutdownHooks.InvokeShutdownHandlers()
317+
log.Println("Calling", len(factory.invariantShutdownHooks.handlers), "shutdownHooks")
316318
factory.shutdownHooks.InvokeShutdownHandlers()
319+
log.Println("Shutdown is done")
317320
factory.shutdownInProgress = false
318321
}
319322

e2e/fixtures/fixtures.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (shutdown *ShutdownHooks) InvokeShutdownHandlers() {
5555
// we are doing any checks. If the below Expect expression is false the further execution will be stopped and
5656
// the handler would never be reset.
5757
handler := shutdown.handlers
58-
// clear handlers so we can be reused.
58+
// clear handlers so it can be reused.
5959
shutdown.handlers = []func() error{}
6060
// iterate over the array in reverse order.
6161
for i := len(handler); i != 0; i-- {

e2e/test_operator_plugin/operator_plugin_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@ var _ = AfterSuite(func() {
6565
})
6666

6767
var _ = Describe("Operator Plugin", Label("e2e", "pr"), func() {
68-
AfterEach(func() {
69-
if CurrentSpecReport().Failed() {
70-
factory.DumpStateHaCluster(fdbCluster)
71-
}
72-
})
73-
7468
When("getting the plugin version from the operator pod", func() {
7569
It("should print the version", func() {
7670
// Pick one operator pod and execute the kubectl version command to ensure that kubectl-fdb is present
@@ -141,8 +135,9 @@ var _ = Describe("Operator Plugin", Label("e2e", "pr"), func() {
141135
AfterEach(func() {
142136
log.Println("Recreate cluster")
143137
// Delete the broken cluster.
144-
fdbCluster.Delete()
138+
factory.Shutdown()
145139
// Recreate the cluster to make sure the next tests can proceed
140+
factory = fixtures.CreateFactory(testOptions)
146141
fdbCluster = factory.CreateFdbHaCluster(clusterConfig, clusterOptions...)
147142
})
148143

@@ -185,6 +180,10 @@ var _ = Describe("Operator Plugin", Label("e2e", "pr"), func() {
185180
}
186181
Expect(errGroup.Wait()).NotTo(HaveOccurred())
187182

183+
for _, cluster := range fdbCluster.GetAllClusters() {
184+
Expect(cluster.GetCluster().UseDNSInClusterFile()).To(BeTrue())
185+
}
186+
188187
// This tests is a destructive test where the cluster will stop working for some period.
189188
primary := fdbCluster.GetPrimary()
190189
primary.SetSkipReconciliation(true)
@@ -239,8 +238,9 @@ var _ = Describe("Operator Plugin", Label("e2e", "pr"), func() {
239238
AfterEach(func() {
240239
log.Println("Recreate cluster")
241240
// Delete the broken cluster.
242-
fdbCluster.Delete()
241+
factory.Shutdown()
243242
// Recreate the cluster to make sure the next tests can proceed
243+
factory = fixtures.CreateFactory(testOptions)
244244
fdbCluster = factory.CreateFdbHaCluster(clusterConfig, clusterOptions...)
245245
})
246246

0 commit comments

Comments
 (0)