Fix flake in extended job tests
missing cleanup of autoerrand
@@ -37,12 +37,17 @@ var _ = Describe("ExtendedJob", func() {
var (
ej ejv1.ExtendedJob
+ tearDowns []environment.TearDownFunc
)
BeforeEach(func() {
ej = env.AutoErrandExtendedJob("autoerrand-job")
})
+ AfterEach(func() {
+ Expect(env.TearDownAll(tearDowns)).To(Succeed())
+ })
+
It("immediately starts the job", func() {
_, tearDown, err := env.CreateExtendedJob(env.Namespace, ej)
Expect(err).NotTo(HaveOccurred())
@@ -142,7 +147,6 @@ var _ = Describe("ExtendedJob", func() {
var (
configMap corev1.ConfigMap
secret corev1.Secret
- tearDowns []environment.TearDownFunc
tearDownEJ environment.TearDownFunc
)
@@ -169,10 +173,6 @@ var _ = Describe("ExtendedJob", func() {
Expect(err).NotTo(HaveOccurred())
})
- AfterEach(func() {
- Expect(env.TearDownAll(tearDowns)).To(Succeed())
- })
-
Context("when a config content changes", func() {
It("it creates a new job", func() {
By("checking if ext job is done")
@@ -199,7 +199,6 @@ var _ = Describe("ExtendedJob", func() {
var (
configMap corev1.ConfigMap
secret corev1.Secret
- tearDowns []environment.TearDownFunc
tearDownEJ environment.TearDownFunc
)
