Add pre pull of e2e images after DiskPressure test

The "system_node_critical_test" causes DiskPressure on the node,
resulting in eviction of some of the pre pulled images. This makes all
the resulting tests to fail, since their pod spec use PullPolicy: Never

The PrePullImages is now inside a defer, so it will be executed even tho
the assertions inside the "AfterEach" fail.
This commit is contained in:
Odin Ugedal
2019-08-27 14:55:46 +02:00
parent bdfc8f62b4
commit b9071991e3
2 changed files with 15 additions and 5 deletions

View File

@@ -95,6 +95,13 @@ var _ = framework.KubeDescribe("SystemNodeCriticalPod [Slow] [Serial] [Disruptiv
}, time.Minute*8, time.Second*4).ShouldNot(gomega.HaveOccurred())
})
ginkgo.AfterEach(func() {
defer func() {
if framework.TestContext.PrepullImages {
// The test may cause the prepulled images to be evicted,
// prepull those images again to ensure this test not affect following tests.
PrePullAllImages()
}
}()
ginkgo.By("delete the static pod")
err := deleteStaticPod(podPath, staticPodName, ns)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
@@ -103,6 +110,7 @@ var _ = framework.KubeDescribe("SystemNodeCriticalPod [Slow] [Serial] [Disruptiv
gomega.Eventually(func() error {
return checkMirrorPodDisappear(f.ClientSet, mirrorPodName, ns)
}, time.Minute, time.Second*2).Should(gomega.BeNil())
})
})
})