test: include tests for Login based on different protocol prefixes

Signed-off-by: Jesse Simpson <jesse.simpson36@gmail.com>
pull/30916/head
Jesse Simpson 4 months ago
parent c0f3ace52d
commit 099a9e18f3
No known key found for this signature in database
GPG Key ID: 237495C89AB0AAFC

@ -28,6 +28,7 @@ import (
type HTTPRegistryClientTestSuite struct {
TestSuite
protocol string
}
func (suite *HTTPRegistryClientTestSuite) SetupSuite() {
@ -56,14 +57,23 @@ func (suite *HTTPRegistryClientTestSuite) Test_0_Login() {
}
func (suite *HTTPRegistryClientTestSuite) Test_1_Push() {
if suite.protocol != "" {
return
}
testPush(&suite.TestSuite)
}
func (suite *HTTPRegistryClientTestSuite) Test_2_Pull() {
if suite.protocol != "" {
return
}
testPull(&suite.TestSuite)
}
func (suite *HTTPRegistryClientTestSuite) Test_3_Tags() {
if suite.protocol != "" {
return
}
testTags(&suite.TestSuite)
}
@ -78,4 +88,11 @@ func (suite *HTTPRegistryClientTestSuite) Test_4_ManInTheMiddle() {
func TestHTTPRegistryClientTestSuite(t *testing.T) {
suite.Run(t, new(HTTPRegistryClientTestSuite))
for _, protocol := range []string{"oci://", "http://", "https://"} {
var protocolSpecificTestSuite = new(HTTPRegistryClientTestSuite)
protocolSpecificTestSuite.protocol = protocol
protocolSpecificTestSuite.DockerRegistryHost = protocol + "helm-test-registry"
suite.Run(t, protocolSpecificTestSuite)
}
}

@ -127,7 +127,12 @@ func setup(suite *TestSuite, tlsEnabled, insecure bool) *registry.Registry {
// Change the registry host to another host which is not localhost.
// This is required because Docker enforces HTTP if the registry
// host is localhost/127.0.0.1.
suite.DockerRegistryHost = fmt.Sprintf("helm-test-registry:%d", port)
if suite.DockerRegistryHost == "" {
suite.DockerRegistryHost = fmt.Sprintf("helm-test-registry:%d", port)
} else {
// may programmatically set this for custom protocol handling
suite.DockerRegistryHost = fmt.Sprintf("%s:%d", suite.DockerRegistryHost, port)
}
suite.srv, err = mockdns.NewServer(map[string]mockdns.Zone{
"helm-test-registry.": {
A: []string{"127.0.0.1"},

Loading…
Cancel
Save