CreateTestNamespace creates a namespace creates a namespace. Prefer CreateUniqueTestNamespace instead, unless you need a specific namespace name. If so, make sure there is no collision potential. The namespace is automatically cleaned up at the end of the test.
( ctx context.Context, crudClient client.Client, name string, opts ...client.CreateOption, )
| 106 | // potential. |
| 107 | // The namespace is automatically cleaned up at the end of the test. |
| 108 | func CreateTestNamespace( |
| 109 | ctx context.Context, |
| 110 | crudClient client.Client, |
| 111 | name string, |
| 112 | opts ...client.CreateOption, |
| 113 | ) error { |
| 114 | err := CreateNamespace(ctx, crudClient, name, opts...) |
| 115 | if err != nil { |
| 116 | return err |
| 117 | } |
| 118 | |
| 119 | ginkgo.DeferCleanup(func() error { |
| 120 | return cleanupNamespace( |
| 121 | ctx, |
| 122 | crudClient, |
| 123 | name, |
| 124 | ginkgo.CurrentSpecReport().LeafNodeText, |
| 125 | ginkgo.CurrentSpecReport().Failed(), |
| 126 | ) |
| 127 | }) |
| 128 | |
| 129 | return nil |
| 130 | } |
| 131 | |
| 132 | // CreateNamespace creates a namespace. |
| 133 | func CreateNamespace( |
no test coverage detected