Browse code

Allow to pull from insecure registries for unit tests

Signed-off-by: Michal Minář <miminar@redhat.com>

Michal Minář authored on 2016/08/05 19:18:46
Showing 1 changed files
... ...
@@ -20,8 +20,9 @@ import (
20 20
 type pullthroughBlobStore struct {
21 21
 	distribution.BlobStore
22 22
 
23
-	repo          *repository
24
-	digestToStore map[string]distribution.BlobStore
23
+	repo                       *repository
24
+	digestToStore              map[string]distribution.BlobStore
25
+	pullFromInsecureRegistries bool
25 26
 }
26 27
 
27 28
 var _ distribution.BlobStore = &pullthroughBlobStore{}
... ...
@@ -84,7 +85,7 @@ func (r *pullthroughBlobStore) Stat(ctx context.Context, dgst digest.Digest) (di
84 84
 // r.digestToStore saves the store.
85 85
 func (r *pullthroughBlobStore) proxyStat(ctx context.Context, retriever importer.RepositoryRetriever, ref imageapi.DockerImageReference, dgst digest.Digest) (distribution.Descriptor, error) {
86 86
 	context.GetLogger(r.repo.ctx).Infof("Trying to stat %q from %q", dgst, ref.Exact())
87
-	repo, err := retriever.Repository(ctx, ref.RegistryURL(), ref.RepositoryName(), false)
87
+	repo, err := retriever.Repository(ctx, ref.RegistryURL(), ref.RepositoryName(), r.pullFromInsecureRegistries)
88 88
 	if err != nil {
89 89
 		context.GetLogger(r.repo.ctx).Errorf("Error getting remote repository for image %q: %v", ref.Exact(), err)
90 90
 		return distribution.Descriptor{}, err