mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
Now you can work with self signed registries by updating your deployment with adding `--allowInsecureRegistry` to the `args` field. Signed-off-by: Anton Popovichenko <anton.popovichenko@mendix.com> Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
37 lines
1,009 B
Go
37 lines
1,009 B
Go
package registryclient
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"github.com/google/go-containerregistry/pkg/v1/remote"
|
|
"gotest.tools/assert"
|
|
)
|
|
|
|
// Make sure that client conforms Client interface.
|
|
var _ Client = &client{}
|
|
|
|
func TestInitClientWithEmptyOptions(t *testing.T) {
|
|
expClient := &client{
|
|
transport: remote.DefaultTransport,
|
|
}
|
|
c, err := InitClient()
|
|
assert.NilError(t, err)
|
|
assert.Assert(t, expClient.transport == c.Transport())
|
|
assert.Assert(t, c.Keychain() != nil)
|
|
}
|
|
|
|
func TestInitClientWithInsecureRegistryOption(t *testing.T) {
|
|
expClient := &client{
|
|
transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
|
|
}
|
|
c, err := InitClient(WithAllowInsecureRegistry())
|
|
|
|
expInsecureSkipVerify := expClient.transport.TLSClientConfig.InsecureSkipVerify
|
|
gotInsecureSkipVerify := c.Transport().TLSClientConfig.InsecureSkipVerify
|
|
|
|
assert.NilError(t, err)
|
|
assert.Assert(t, expInsecureSkipVerify == gotInsecureSkipVerify)
|
|
assert.Assert(t, c.Keychain() != nil)
|
|
}
|