mirror of https://github.com/k3s-io/k3s
Improve E2E Aftersuite cleanup
Signed-off-by: Derek Nola <derek.nola@suse.com>pull/9733/head
parent
1a07661b9c
commit
1438a7d57b
|
@ -90,9 +90,7 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed || *ci {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,10 +195,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,14 +142,13 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
|
if !failed {
|
||||||
if failed && !*ci {
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
fmt.Println("FAILED!")
|
}
|
||||||
} else {
|
if !failed || *ci {
|
||||||
r2, err := e2e.RunCmdOnNode("kubectl delete deployment my-webpage-1 my-webpage-2 my-webpage-3", serverNodeNames[0])
|
r2, err := e2e.RunCmdOnNode("kubectl delete deployment my-webpage-1 my-webpage-2 my-webpage-3", serverNodeNames[0])
|
||||||
Expect(err).NotTo(HaveOccurred(), r2)
|
Expect(err).NotTo(HaveOccurred(), r2)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,10 +165,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,15 +146,15 @@ var _ = AfterEach(func() {
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
|
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
} else {
|
}
|
||||||
|
if !failed || *ci {
|
||||||
r1, err := e2e.RunCmdOnNode("docker rm -f registry", serverNodeNames[0])
|
r1, err := e2e.RunCmdOnNode("docker rm -f registry", serverNodeNames[0])
|
||||||
Expect(err).NotTo(HaveOccurred(), r1)
|
Expect(err).NotTo(HaveOccurred(), r1)
|
||||||
r2, err := e2e.RunCmdOnNode("kubectl delete deployment my-webpage", serverNodeNames[0])
|
r2, err := e2e.RunCmdOnNode("kubectl delete deployment my-webpage", serverNodeNames[0])
|
||||||
Expect(err).NotTo(HaveOccurred(), r2)
|
Expect(err).NotTo(HaveOccurred(), r2)
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,10 +138,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,17 +130,18 @@ var _ = Describe("Verify Create", Ordered, func() {
|
||||||
// https://github.com/rancher/rke2/issues/3714
|
// https://github.com/rancher/rke2/issues/3714
|
||||||
// Once fixed, ensure that the snapshots list are actually reduced to 2
|
// Once fixed, ensure that the snapshots list are actually reduced to 2
|
||||||
It("prunes s3 snapshots", func() {
|
It("prunes s3 snapshots", func() {
|
||||||
res, err := e2e.RunCmdOnNode("k3s etcd-snapshot save", serverNodeNames[0])
|
_, err := e2e.RunCmdOnNode("k3s etcd-snapshot save", serverNodeNames[0])
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
res, err = e2e.RunCmdOnNode("k3s etcd-snapshot save", serverNodeNames[0])
|
_, err = e2e.RunCmdOnNode("k3s etcd-snapshot save", serverNodeNames[0])
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
_, err = e2e.RunCmdOnNode("k3s etcd-snapshot prune --snapshot-retention 2", serverNodeNames[0])
|
res, err := e2e.RunCmdOnNode("k3s etcd-snapshot prune --snapshot-retention 2", serverNodeNames[0])
|
||||||
res, err = e2e.RunCmdOnNode("sudo k3s etcd-snapshot prune --snapshot-retention 2", serverNodeNames[0])
|
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(res).To(ContainSubstring("Reconciliation of ETCDSnapshotFile resources complete"))
|
Expect(res).To(ContainSubstring("Reconciliation of ETCDSnapshotFile resources complete"))
|
||||||
|
|
||||||
_, err = e2e.RunCmdOnNode("k3s etcd-snapshot ls|grep 'on-demand'|wc -l>count", serverNodeNames[0])
|
_, err = e2e.RunCmdOnNode("k3s etcd-snapshot ls|grep 'on-demand'|wc -l>count", serverNodeNames[0])
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
res, err = e2e.RunCmdOnNode("grep '^[4]$' ./count", serverNodeNames[0])
|
res, err = e2e.RunCmdOnNode("grep '^[4]$' ./count", serverNodeNames[0])
|
||||||
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(strings.TrimSpace(res)).To(Equal("4"))
|
Expect(strings.TrimSpace(res)).To(Equal("4"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -153,10 +154,10 @@ var _ = AfterEach(func() {
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
|
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,10 +221,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(serverNodeNames)).To(Succeed())
|
Expect(e2e.GetCoverageReport(serverNodeNames)).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -306,10 +306,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(serverNodeNames)).To(Succeed())
|
Expect(e2e.GetCoverageReport(serverNodeNames)).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,10 +317,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,9 +229,7 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed || *ci {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,10 +277,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,10 +201,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -385,10 +385,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,10 +382,10 @@ var _ = AfterEach(func() {
|
||||||
})
|
})
|
||||||
|
|
||||||
var _ = AfterSuite(func() {
|
var _ = AfterSuite(func() {
|
||||||
if failed && !*ci {
|
if !failed {
|
||||||
fmt.Println("FAILED!")
|
|
||||||
} else {
|
|
||||||
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
Expect(e2e.GetCoverageReport(append(serverNodeNames, agentNodeNames...))).To(Succeed())
|
||||||
|
}
|
||||||
|
if !failed || *ci {
|
||||||
Expect(e2e.DestroyCluster()).To(Succeed())
|
Expect(e2e.DestroyCluster()).To(Succeed())
|
||||||
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
Expect(os.Remove(kubeConfigFile)).To(Succeed())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue