fix(digest): check container image info for nil (#1027)

This commit is contained in:
nils måsén 2021-07-25 12:44:29 +02:00 committed by GitHub
parent 7221704638
commit 9bb8991a76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 1 deletions

View file

@ -59,6 +59,8 @@ var _ = Describe("Digests", func() {
mockCreated,
mockDigest)
mockContainerNoImage := mocks.CreateMockContainerWithImageInfoP(mockId, mockName, mockImage, mockCreated, nil)
When("a digest comparison is done", func() {
It("should return true if digests match",
SkipIfCredentialsEmpty(GHCRCredentials, func() {
@ -75,6 +77,11 @@ var _ = Describe("Digests", func() {
It("should return an error if the registry isn't available", func() {
})
It("should return an error when container contains no image info", func() {
matches, err := digest.CompareDigest(mockContainerNoImage, `user:pass`)
Expect(err).To(HaveOccurred())
Expect(matches).To(Equal(false))
})
})
When("using different registries", func() {
It("should work with DockerHub",