mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
fix e2e delete namespace bug
This commit is contained in:
@@ -445,7 +445,10 @@ func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (
|
||||
createTestingNS = CreateTestingNS
|
||||
}
|
||||
ns, err := createTestingNS(baseName, f.ClientSet, labels)
|
||||
if err == nil {
|
||||
// check ns instead of err to see if it's nil as we may
|
||||
// fail to create serviceAccount in it.
|
||||
// In this case, we should not forget to delete the namespace.
|
||||
if ns != nil {
|
||||
f.namespacesToDelete = append(f.namespacesToDelete, ns)
|
||||
}
|
||||
return ns, err
|
||||
|
@@ -912,7 +912,10 @@ func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]s
|
||||
|
||||
if TestContext.VerifyServiceAccount {
|
||||
if err := WaitForDefaultServiceAccountInNamespace(c, got.Name); err != nil {
|
||||
return nil, err
|
||||
// Even if we fail to create serviceAccount in the namespace,
|
||||
// we have successfully create a namespace.
|
||||
// So, return the created namespace.
|
||||
return got, err
|
||||
}
|
||||
}
|
||||
return got, nil
|
||||
|
Reference in New Issue
Block a user