From e0d6c60c25fe660c8aa73c192252f13ea2fc41ac Mon Sep 17 00:00:00 2001 From: aram price Date: Mon, 23 Mar 2026 10:40:11 +0100 Subject: [PATCH] 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. --- cmd/logs_test.go | 3 ++- release/pkg/compiled_package_test.go | 3 ++- release/resource/resource_test.go | 3 ++- releasedir/fs_blobs_dir_test.go | 2 +- releasedir/index/fs_index_blobs_test.go | 5 +++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cmd/logs_test.go b/cmd/logs_test.go index 5a65c252c..4c59ec914 100644 --- a/cmd/logs_test.go +++ b/cmd/logs_test.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "os" + "strings" "time" "code.cloudfoundry.org/clock" @@ -750,7 +751,7 @@ var _ = Describe("Logs", func() { err := command.Run(logsOpts) Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("Unable to parse digest string")) + Expect(strings.ToLower(err.Error())).To(ContainSubstring("unable to parse digest string")) }) It("returns error if verifying the log file sha fails", func() { diff --git a/release/pkg/compiled_package_test.go b/release/pkg/compiled_package_test.go index b7cb50700..b8a459b76 100644 --- a/release/pkg/compiled_package_test.go +++ b/release/pkg/compiled_package_test.go @@ -2,6 +2,7 @@ package pkg_test import ( "errors" + "strings" "github.com/cloudfoundry/bosh-utils/crypto/cryptofakes" fakes2 "github.com/cloudfoundry/bosh-utils/system/fakes" @@ -188,7 +189,7 @@ var _ = Describe("NewCompiledPackageWithArchive", func() { It("returns an error parsing the current digest", func() { _, err := compiledPkg.RehashWithCalculator(fakeDigestCalculator, fakeArchiveReader) Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("No digest algorithm found. Supported algorithms")) + Expect(strings.ToLower(err.Error())).To(ContainSubstring("no digest algorithm found. supported algorithms")) }) }) }) diff --git a/release/resource/resource_test.go b/release/resource/resource_test.go index 075566b48..2888e2179 100644 --- a/release/resource/resource_test.go +++ b/release/resource/resource_test.go @@ -2,6 +2,7 @@ package resource_test import ( "errors" + "strings" boshcrypto "github.com/cloudfoundry/bosh-utils/crypto" fakesfs "github.com/cloudfoundry/bosh-utils/system/fakes" @@ -483,7 +484,7 @@ var _ = Describe("NewResourceWithBuiltArchive", func() { It("should return an error", func() { _, err := resource.RehashWithCalculator(fakeDigestCalculator, boshcrypto.ArchiveDigestFilePathReader(fakeFs)) Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring("No digest algorithm found. Supported algorithms")) + Expect(strings.ToLower(err.Error())).To(ContainSubstring("no digest algorithm found. supported algorithms")) }) }) }) diff --git a/releasedir/fs_blobs_dir_test.go b/releasedir/fs_blobs_dir_test.go index c4e8730b9..0bc14eedf 100644 --- a/releasedir/fs_blobs_dir_test.go +++ b/releasedir/fs_blobs_dir_test.go @@ -309,7 +309,7 @@ bad-sha-blob.tgz: It("returns descriptive error", func() { err := act(1) - Expect(err).To(MatchError(ContainSubstring("No digest algorithm found. Supported algorithms: sha1, sha256, sha512"))) + Expect(strings.ToLower(err.Error())).To(ContainSubstring("no digest algorithm found. supported algorithms: sha1, sha256, sha512")) }) }) diff --git a/releasedir/index/fs_index_blobs_test.go b/releasedir/index/fs_index_blobs_test.go index f0ee5e5d1..c72b196c6 100644 --- a/releasedir/index/fs_index_blobs_test.go +++ b/releasedir/index/fs_index_blobs_test.go @@ -4,6 +4,7 @@ import ( "errors" "os" "path/filepath" + "strings" "syscall" fakeblob "github.com/cloudfoundry/bosh-utils/blobstore/fakes" @@ -163,8 +164,8 @@ var _ = Describe("FSIndexBlobs", func() { //currently, the only way to cause a digest parse failure is with an empty string _, err := blobs.Get("name", "blob-id", "") Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(ContainSubstring( - "No digest algorithm found. Supported algorithms: sha1, sha256, sha512")) + Expect(strings.ToLower(err.Error())).To(ContainSubstring( + "no digest algorithm found. supported algorithms: sha1, sha256, sha512")) }) Context("when downloading blob fails", func() {