Sfoglia il codice sorgente

add test for 'in' with credentials

Alex Suraci 7 anni fa
parent
commit
79c0030011
2 ha cambiato i file con 23 aggiunte e 1 eliminazioni
  1. 1 1
      cmd/in/main.go
  2. 22 0
      in_test.go

+ 1 - 1
cmd/in/main.go

@@ -79,10 +79,10 @@ func main() {
 		Username: req.Source.Username,
 		Password: req.Source.Password,
 	}
+
 	var image v1.Image
 	if auth.Username != "" && auth.Password != "" {
 		image, err = remote.Image(n, remote.WithAuth(auth))
-
 	} else {
 		image, err = remote.Image(n)
 	}

+ 22 - 0
in_test.go

@@ -184,6 +184,28 @@ var _ = Describe("In", func() {
 		})
 	})
 
+	Describe("fetching from a private repository with credentials", func() {
+		BeforeEach(func() {
+			req.Source = resource.Source{
+				Repository: privateRepo,
+				Tag:        "latest",
+
+				Username: privateRepoUsername,
+				Password: privateRepoPassword,
+			}
+
+			checkPrivateRepoConfigured()
+
+			req.Version = resource.Version{
+				Digest: PRIVATE_LATEST_STATIC_DIGEST,
+			}
+		})
+
+		It("works", func() {
+			Expect(cat(rootfsPath("Dockerfile"))).To(ContainSubstring("hello!"))
+		})
+	})
+
 	Describe("fetching in OCI format", func() {
 		var manifest *v1.Manifest