Skip to content

Commit e4b3188

Browse files
committed
pkg/test/resource_creator.go: return error if namespace already exists
1 parent 66fb260 commit e4b3188

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/test/resource_creator.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package test
1717
import (
1818
"bytes"
1919
"errors"
20+
"fmt"
2021
"io/ioutil"
2122
"strings"
2223

@@ -45,7 +46,7 @@ func (ctx *TestCtx) GetNamespace() (string, error) {
4546
namespaceObj := &core.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ctx.Namespace}}
4647
_, err := Global.KubeClient.CoreV1().Namespaces().Create(namespaceObj)
4748
if apierrors.IsAlreadyExists(err) {
48-
return ctx.Namespace, nil
49+
return "", fmt.Errorf("Namespace %s already exists: %v", ctx.Namespace, err)
4950
} else if err != nil {
5051
return "", err
5152
}

0 commit comments

Comments
 (0)