Skip to content

Commit a22fd64

Browse files
committed
Fix: update specs to match err string w/o case sensitivity
Recent linting changes to bosh-utils have change the case of some err messages, this commit changes err message matching to be case-insensitive to avoid future breakage.
1 parent 27da0d5 commit a22fd64

5 files changed

Lines changed: 10 additions & 6 deletions

File tree

cmd/logs_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"os"
7+
"strings"
78
"time"
89

910
"code.cloudfoundry.org/clock"
@@ -750,7 +751,7 @@ var _ = Describe("Logs", func() {
750751

751752
err := command.Run(logsOpts)
752753
Expect(err).To(HaveOccurred())
753-
Expect(err.Error()).To(ContainSubstring("Unable to parse digest string"))
754+
Expect(strings.ToLower(err.Error())).To(ContainSubstring("unable to parse digest string"))
754755
})
755756

756757
It("returns error if verifying the log file sha fails", func() {

release/pkg/compiled_package_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package pkg_test
22

33
import (
44
"errors"
5+
"strings"
56

67
"github.com/cloudfoundry/bosh-utils/crypto/cryptofakes"
78
fakes2 "github.com/cloudfoundry/bosh-utils/system/fakes"
@@ -188,7 +189,7 @@ var _ = Describe("NewCompiledPackageWithArchive", func() {
188189
It("returns an error parsing the current digest", func() {
189190
_, err := compiledPkg.RehashWithCalculator(fakeDigestCalculator, fakeArchiveReader)
190191
Expect(err).To(HaveOccurred())
191-
Expect(err.Error()).To(ContainSubstring("No digest algorithm found. Supported algorithms"))
192+
Expect(strings.ToLower(err.Error())).To(ContainSubstring("no digest algorithm found. supported algorithms"))
192193
})
193194
})
194195
})

release/resource/resource_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package resource_test
22

33
import (
44
"errors"
5+
"strings"
56

67
boshcrypto "github.com/cloudfoundry/bosh-utils/crypto"
78
fakesfs "github.com/cloudfoundry/bosh-utils/system/fakes"
@@ -483,7 +484,7 @@ var _ = Describe("NewResourceWithBuiltArchive", func() {
483484
It("should return an error", func() {
484485
_, err := resource.RehashWithCalculator(fakeDigestCalculator, boshcrypto.ArchiveDigestFilePathReader(fakeFs))
485486
Expect(err).To(HaveOccurred())
486-
Expect(err.Error()).To(ContainSubstring("No digest algorithm found. Supported algorithms"))
487+
Expect(strings.ToLower(err.Error())).To(ContainSubstring("no digest algorithm found. supported algorithms"))
487488
})
488489
})
489490
})

releasedir/fs_blobs_dir_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ bad-sha-blob.tgz:
309309

310310
It("returns descriptive error", func() {
311311
err := act(1)
312-
Expect(err).To(MatchError(ContainSubstring("No digest algorithm found. Supported algorithms: sha1, sha256, sha512")))
312+
Expect(strings.ToLower(err.Error())).To(ContainSubstring("no digest algorithm found. supported algorithms: sha1, sha256, sha512"))
313313
})
314314
})
315315

releasedir/index/fs_index_blobs_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"os"
66
"path/filepath"
7+
"strings"
78
"syscall"
89

910
fakeblob "github.com/cloudfoundry/bosh-utils/blobstore/fakes"
@@ -163,8 +164,8 @@ var _ = Describe("FSIndexBlobs", func() {
163164
//currently, the only way to cause a digest parse failure is with an empty string
164165
_, err := blobs.Get("name", "blob-id", "")
165166
Expect(err).To(HaveOccurred())
166-
Expect(err.Error()).To(ContainSubstring(
167-
"No digest algorithm found. Supported algorithms: sha1, sha256, sha512"))
167+
Expect(strings.ToLower(err.Error())).To(ContainSubstring(
168+
"no digest algorithm found. supported algorithms: sha1, sha256, sha512"))
168169
})
169170

170171
Context("when downloading blob fails", func() {

0 commit comments

Comments
 (0)