mirror of https://github.com/k3s-io/k3s
Merge pull request #57254 from Random-Liu/fix-e2e-test
Automatic merge from submit-queue (batch tested with PRs 55977, 56198, 57202, 57254, 57214). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix e2e test cleanup. E2E test should use `AfterEach` instead of `AddCleanupAction`. `CleanupAction` only runs once after all tests finish https://github.com/kubernetes/kubernetes/blob/master/test/e2e/e2e.go#L258. I hit this issue very frequently that once `Aggregator` test fails, all following tests all fail because the cleanup function does not run after the test, and namespace controller stops working with full of errors: ``` unable to retrieve the complete list of server APIs: wardle.k8s.io/v1alpha1: the server could not find the requested resource ``` Examples: * https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-cri-containerd-e2e-gci-gce/940 * https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-kubernetes-e2e-gci-gce/19115 * https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-kubernetes-e2e-gci-gce/18763 * https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/logs/ci-kubernetes-e2e-gci-gce/18751 Signed-off-by: Lantao Liu <lantaol@google.com> **Release note**: ```release-note none ```pull/6/head
commit
88704f3f2d
|
@ -53,12 +53,6 @@ var _ = SIGDescribe("Aggregator", func() {
|
|||
var c clientset.Interface
|
||||
var aggrclient *aggregatorclient.Clientset
|
||||
f := framework.NewDefaultFramework("aggregator")
|
||||
framework.AddCleanupAction(func() {
|
||||
// Cleanup actions will be called even when the tests are skipped and leaves namespace unset.
|
||||
if len(ns) > 0 {
|
||||
cleanTest(c, aggrclient, ns)
|
||||
}
|
||||
})
|
||||
|
||||
BeforeEach(func() {
|
||||
c = f.ClientSet
|
||||
|
@ -66,6 +60,10 @@ var _ = SIGDescribe("Aggregator", func() {
|
|||
aggrclient = f.AggregatorClient
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
cleanTest(c, aggrclient, ns)
|
||||
})
|
||||
|
||||
It("Should be able to support the 1.7 Sample API Server using the current Aggregator", func() {
|
||||
// Make sure the relevant provider supports Agggregator
|
||||
framework.SkipUnlessServerVersionGTE(serverAggregatorVersion, f.ClientSet.Discovery())
|
||||
|
|
Loading…
Reference in New Issue