| ... | ... |
@@ -119,6 +119,24 @@ func deleteAllContent(client osclient.Interface, namespace string) (err error) {
|
| 119 | 119 |
if err != nil {
|
| 120 | 120 |
return err |
| 121 | 121 |
} |
| 122 |
+ err = deleteTemplates(client, namespace) |
|
| 123 |
+ if err != nil {
|
|
| 124 |
+ return err |
|
| 125 |
+ } |
|
| 126 |
+ return nil |
|
| 127 |
+} |
|
| 128 |
+ |
|
| 129 |
+func deleteTemplates(client osclient.Interface, ns string) error {
|
|
| 130 |
+ items, err := client.Templates(ns).List(labels.Everything(), fields.Everything()) |
|
| 131 |
+ if err != nil {
|
|
| 132 |
+ return err |
|
| 133 |
+ } |
|
| 134 |
+ for i := range items.Items {
|
|
| 135 |
+ err := client.Templates(ns).Delete(items.Items[i].Name) |
|
| 136 |
+ if err != nil {
|
|
| 137 |
+ return err |
|
| 138 |
+ } |
|
| 139 |
+ } |
|
| 122 | 140 |
return nil |
| 123 | 141 |
} |
| 124 | 142 |
|
| ... | ... |
@@ -45,6 +45,7 @@ func TestSyncNamespaceThatIsTerminating(t *testing.T) {
|
| 45 | 45 |
"list-roleBinding", |
| 46 | 46 |
"list-role", |
| 47 | 47 |
"list-routes", |
| 48 |
+ "list-templates", |
|
| 48 | 49 |
"list-builds", |
| 49 | 50 |
"finalize-namespace", |
| 50 | 51 |
"list-deploymentconfig", |
| ... | ... |
@@ -56,7 +57,7 @@ func TestSyncNamespaceThatIsTerminating(t *testing.T) {
|
| 56 | 56 |
for i := range mockOriginClient.Actions {
|
| 57 | 57 |
actionSet.Insert(mockOriginClient.Actions[i].Action) |
| 58 | 58 |
} |
| 59 |
- if !actionSet.HasAll(expectedActionSet.List()...) {
|
|
| 59 |
+ if !(actionSet.HasAll(expectedActionSet.List()...) && (len(actionSet) == len(expectedActionSet))) {
|
|
| 60 | 60 |
t.Errorf("Expected actions: %v, but got: %v", expectedActionSet, actionSet)
|
| 61 | 61 |
} |
| 62 | 62 |
} |