Skip to content

Commit ce9e21b

Browse files
committed
pkg/test: make namespace flags work correctly
1 parent 52202fd commit ce9e21b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pkg/test/context.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ func (f *Framework) NewTestCtx(t *testing.T) TestCtx {
4646

4747
id := prefix + "-" + strconv.FormatInt(time.Now().Unix(), 10)
4848
return TestCtx{
49-
ID: id,
50-
Namespace: *f.Namespace,
49+
ID: id,
5150
}
5251
}
5352

pkg/test/resource_creator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ func (ctx *TestCtx) GetNamespace() (string, error) {
5353
}
5454
namespaceObj := &core.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ctx.Namespace}}
5555
_, err := Global.KubeClient.CoreV1().Namespaces().Create(namespaceObj)
56-
if err != nil {
56+
if apierrors.IsAlreadyExists(err) {
57+
return ctx.Namespace, nil
58+
} else if err != nil {
5759
return "", err
5860
}
5961
ctx.AddFinalizerFn(func() error {

0 commit comments

Comments
 (0)