From e3333ad7b2327a015d7bb45cb39adc1ab0ae1db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20ma=CC=8Ase=CC=81n?= Date: Wed, 12 Apr 2023 08:34:39 +0200 Subject: [PATCH] fix tests that broke with merge --- pkg/registry/auth/auth_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/registry/auth/auth_test.go b/pkg/registry/auth/auth_test.go index 0fa2e77..f29ebff 100644 --- a/pkg/registry/auth/auth_test.go +++ b/pkg/registry/auth/auth_test.go @@ -68,7 +68,8 @@ var _ = Describe("the auth module", func() { Describe("GetAuthURL", func() { It("should create a valid auth url object based on the challenge header supplied", func() { challenge := `bearer realm="https://ghcr.io/token",service="ghcr.io",scope="repository:user/image:pull"` - imageRef, _ := ref.ParseNormalizedNamed("containrrr/watchtower") + imageRef, err := ref.ParseNormalizedNamed("containrrr/watchtower") + Expect(err).NotTo(HaveOccurred()) expected := &url.URL{ Host: "ghcr.io", Scheme: "https", @@ -84,7 +85,8 @@ var _ = Describe("the auth module", func() { When("given an invalid challenge header", func() { It("should return an error", func() { challenge := `bearer realm="https://ghcr.io/token"` - imageRef, _ := ref.ParseNormalizedNamed("containrrr/watchtower") + imageRef, err := ref.ParseNormalizedNamed("containrrr/watchtower") + Expect(err).NotTo(HaveOccurred()) URL, err := auth.GetAuthURL(challenge, imageRef) Expect(err).To(HaveOccurred()) Expect(URL).To(BeNil()) @@ -112,13 +114,17 @@ var _ = Describe("the auth module", func() { }) It("should not crash when an empty field is recieved", func() { input := `bearer realm="https://ghcr.io/token",service="ghcr.io",scope="repository:user/image:pull",` - res, err := auth.GetAuthURL(input, "containrrr/watchtower") + imageRef, err := ref.ParseNormalizedNamed("containrrr/watchtower") + Expect(err).NotTo(HaveOccurred()) + res, err := auth.GetAuthURL(input, imageRef) Expect(err).NotTo(HaveOccurred()) Expect(res).NotTo(BeNil()) }) It("should not crash when a field without a value is recieved", func() { input := `bearer realm="https://ghcr.io/token",service="ghcr.io",scope="repository:user/image:pull",valuelesskey` - res, err := auth.GetAuthURL(input, "containrrr/watchtower") + imageRef, err := ref.ParseNormalizedNamed("containrrr/watchtower") + Expect(err).NotTo(HaveOccurred()) + res, err := auth.GetAuthURL(input, imageRef) Expect(err).NotTo(HaveOccurred()) Expect(res).NotTo(BeNil()) })