Skip to content

Commit

Permalink
skip instead of failing if test vars aren't set
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Nov 13, 2018
1 parent 0cc81e7 commit 70e97f8
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
17 changes: 11 additions & 6 deletions check/check_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ var v2signing = os.Getenv("SEMVER_TESTING_V2_SIGNING") == "true"

var _ = BeforeSuite(func() {
var err error

Expect(accessKeyID).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_ACCESS_KEY_ID")
Expect(secretAccessKey).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_SECRET_ACCESS_KEY")
Expect(bucketName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_BUCKET")
Expect(regionName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_REGION")

if _, err = os.Stat("/opt/resource/check"); err == nil {
checkPath = "/opt/resource/check"
} else {
Expand All @@ -33,6 +27,17 @@ var _ = BeforeSuite(func() {
}
})

var _ = BeforeEach(func() {
if accessKeyID == "" || secretAccessKey == "" {
Skip("no bucket configuration; skipping")
}

Expect(accessKeyID).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_ACCESS_KEY_ID")
Expect(secretAccessKey).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_SECRET_ACCESS_KEY")
Expect(bucketName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_BUCKET")
Expect(regionName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_REGION")
})

var _ = AfterSuite(func() {
gexec.CleanupBuildArtifacts()
})
Expand Down
13 changes: 8 additions & 5 deletions in/in_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ var v2signing = os.Getenv("SEMVER_TESTING_V2_SIGNING") == "true"
var _ = BeforeSuite(func() {
var err error

Expect(accessKeyID).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_ACCESS_KEY_ID")
Expect(secretAccessKey).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_SECRET_ACCESS_KEY")
Expect(bucketName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_BUCKET")
Expect(regionName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_REGION")

if _, err = os.Stat("/opt/resource/in"); err == nil {
inPath = "/opt/resource/in"
} else {
Expand All @@ -34,6 +29,14 @@ var _ = BeforeSuite(func() {
})

var _ = BeforeEach(func() {
if accessKeyID == "" || secretAccessKey == "" {
Skip("no bucket configuration; skipping")
}

Expect(accessKeyID).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_ACCESS_KEY_ID")
Expect(secretAccessKey).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_SECRET_ACCESS_KEY")
Expect(bucketName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_BUCKET")
Expect(regionName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_REGION")
})

var _ = AfterSuite(func() {
Expand Down
16 changes: 11 additions & 5 deletions out/out_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ var v2signing = os.Getenv("SEMVER_TESTING_V2_SIGNING") == "true"
var _ = BeforeSuite(func() {
var err error

Expect(accessKeyID).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_ACCESS_KEY_ID")
Expect(secretAccessKey).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_SECRET_ACCESS_KEY")
Expect(bucketName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_BUCKET")
Expect(regionName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_REGION")

if _, err = os.Stat("/opt/resource/out"); err == nil {
outPath = "/opt/resource/out"
} else {
Expand All @@ -33,6 +28,17 @@ var _ = BeforeSuite(func() {
}
})

var _ = BeforeEach(func() {
if accessKeyID == "" || secretAccessKey == "" {
Skip("no bucket configuration; skipping")
}

Expect(accessKeyID).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_ACCESS_KEY_ID")
Expect(secretAccessKey).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_SECRET_ACCESS_KEY")
Expect(bucketName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_BUCKET")
Expect(regionName).NotTo(BeEmpty(), "must specify $SEMVER_TESTING_REGION")
})

var _ = AfterSuite(func() {
gexec.CleanupBuildArtifacts()
})
Expand Down

0 comments on commit 70e97f8

Please sign in to comment.