mirror of https://github.com/k3s-io/k3s
fix e2e delete namespace bug
parent
3fe2de05ac
commit
0b62cc7f54
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue