Skip to content

Commit

Permalink
pkg/test: make namespace flags work correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexNPavel committed Aug 3, 2018
1 parent 52202fd commit ce9e21b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/test/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ func (f *Framework) NewTestCtx(t *testing.T) TestCtx {

id := prefix + "-" + strconv.FormatInt(time.Now().Unix(), 10)
return TestCtx{
ID: id,
Namespace: *f.Namespace,
ID: id,
}
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/test/resource_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ func (ctx *TestCtx) GetNamespace() (string, error) {
}
namespaceObj := &core.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ctx.Namespace}}
_, err := Global.KubeClient.CoreV1().Namespaces().Create(namespaceObj)
if err != nil {
if apierrors.IsAlreadyExists(err) {
return ctx.Namespace, nil
} else if err != nil {
return "", err
}
ctx.AddFinalizerFn(func() error {
Expand Down

0 comments on commit ce9e21b

Please sign in to comment.