Skip to content

Commit b3f63c5

Browse files
committed
Fix empty env var bug
This solution provides an unlikely-to-exist default when the OCI_CROSSMOUNT_NAMESPACE env var is not provided. Resolves #215 Signed-off-by: Peter Engelbert <[email protected]>
1 parent 43d840e commit b3f63c5

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

conformance/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.13
44

55
require (
66
github.com/bloodorangeio/reggie v0.4.0
7+
github.com/google/uuid v1.1.2
78
github.com/onsi/ginkgo v1.11.0
89
github.com/onsi/gomega v1.8.1
910
github.com/opencontainers/go-digest v1.0.0-rc1

conformance/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ github.com/go-resty/resty/v2 v2.1.0 h1:Z6IefCpUMfnvItVJaJXWv/pMiiD11So35QgwEELsl
66
github.com/go-resty/resty/v2 v2.1.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
77
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
88
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
9+
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
10+
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
911
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
1012
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
1113
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=

conformance/reporter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,7 @@ func (reporter *HTMLReporter) SpecSuiteWillBegin(config config.GinkgoConfigType,
581581
envVarTagList,
582582
envVarHideSkippedWorkflows,
583583
envVarAuthScope,
584+
envVarCrossmountNamespace,
584585
}
585586
for _, v := range varsToCheck {
586587
var replacement string

conformance/setup.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/bloodorangeio/reggie"
1313
g "github.com/onsi/ginkgo"
14+
"github.com/google/uuid"
1415
godigest "github.com/opencontainers/go-digest"
1516
imagespec "github.com/opencontainers/image-spec/specs-go/v1"
1617
)
@@ -139,6 +140,9 @@ func init() {
139140
password := os.Getenv(envVarPassword)
140141
authScope := os.Getenv(envVarAuthScope)
141142
crossmountNamespace = os.Getenv(envVarCrossmountNamespace)
143+
if len(crossmountNamespace) == 0 {
144+
crossmountNamespace = fmt.Sprintf("a-%s", uuid.New())
145+
}
142146

143147
debug, _ := strconv.ParseBool(os.Getenv(envVarDebug))
144148

0 commit comments

Comments
 (0)