fix e2e delete namespace bug

This commit is contained in:
m1093782566
2016-11-03 19:55:46 +08:00
parent 3fe2de05ac
commit 0b62cc7f54
2 changed files with 8 additions and 2 deletions

View File

@@ -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