@@ -13,7 +13,6 @@ import (
1313 "fmt"
1414 "io"
1515 "io/ioutil"
16- "k8s.io/apimachinery/pkg/util/wait"
1716 "math/big"
1817 "net"
1918 "net/http"
@@ -25,6 +24,7 @@ import (
2524 _ "github.com/docker/distribution/registry/storage/driver/filesystem" // Driver for persisting docker image data to the filesystem.
2625 _ "github.com/docker/distribution/registry/storage/driver/inmemory" // Driver for keeping docker image data in memory.
2726 "github.com/phayes/freeport"
27+ "k8s.io/apimachinery/pkg/util/wait"
2828)
2929
3030// RunDockerRegistry runs a docker registry on an available port and returns its host string if successful, otherwise it returns an error.
@@ -67,7 +67,7 @@ func RunDockerRegistry(ctx context.Context, rootDir string) (string, string, err
6767 config .HTTP .Addr = host
6868 config .HTTP .TLS .Certificate = certfile .Name ()
6969 config .HTTP .TLS .Key = keyfile .Name ()
70- config .Log .Level = "debug "
70+ config .Log .Level = "error "
7171
7272 if rootDir != "" {
7373 config .Storage = map [string ]configuration.Parameters {"filesystem" : map [string ]interface {}{
@@ -100,7 +100,7 @@ func RunDockerRegistry(ctx context.Context, rootDir string) (string, string, err
100100 RootCAs : certPool ,
101101 }}
102102 client := & http.Client {Transport : tr }
103- r , err := client .Get ("https://" + host + "/v2/" )
103+ r , err := client .Get ("https://" + host + "/v2/" )
104104 if err != nil {
105105 return false , nil
106106 }
@@ -128,7 +128,7 @@ func certToPem(der []byte) ([]byte, error) {
128128func keyToPem (key * ecdsa.PrivateKey ) ([]byte , error ) {
129129 b , err := x509 .MarshalECPrivateKey (key )
130130 if err != nil {
131- return nil , fmt .Errorf ( "unable to marshal private key: %v" , err )
131+ return nil , fmt .Errorf ("unable to marshal private key: %v" , err )
132132 }
133133 out := & bytes.Buffer {}
134134 if err := pem .Encode (out , & pem.Block {Type : "EC PRIVATE KEY" , Bytes : b }); err != nil {
@@ -137,7 +137,7 @@ func keyToPem(key *ecdsa.PrivateKey) ([]byte, error) {
137137 return out .Bytes (), nil
138138}
139139
140- func GenerateCerts (caWriter , certWriter , keyWriter io.Writer , pool * x509.CertPool ) error {
140+ func GenerateCerts (caWriter , certWriter , keyWriter io.Writer , pool * x509.CertPool ) error {
141141 priv , err := ecdsa .GenerateKey (elliptic .P521 (), rand .Reader )
142142 if err != nil {
143143 return err
@@ -153,7 +153,7 @@ func GenerateCerts(caWriter, certWriter, keyWriter io.Writer, pool *x509.CertPoo
153153 KeyUsage : x509 .KeyUsageKeyEncipherment | x509 .KeyUsageDigitalSignature | x509 .KeyUsageCertSign ,
154154 ExtKeyUsage : []x509.ExtKeyUsage {x509 .ExtKeyUsageServerAuth },
155155 BasicConstraintsValid : true ,
156- IsCA : true ,
156+ IsCA : true ,
157157 }
158158 cert := x509.Certificate {
159159 SerialNumber : big .NewInt (2 ),
0 commit comments