allow insecure registry login
Signed-off-by: Austin Abro <AustinAbro321@gmail.com> only add loginoptinsecure when already logging in Signed-off-by: Austin Abro <AustinAbro321@gmail.com> fix tests, move registry login options Signed-off-by: Austin Abro <AustinAbro321@gmail.com> cleaner code Signed-off-by: Austin Abro <austinabro321@gmail.com> change localhost to 127.0.0.1 in insecure suite test path Signed-off-by: Austin Abro <austinabro321@gmail.com> let myself run tests Signed-off-by: Austin Abro <AustinAbro321@gmail.com> allow myself to run tests Signed-off-by: Austin Abro <AustinAbro321@gmail.com> clearer error message in test Signed-off-by: Austin Abro <AustinAbro321@gmail.com> update test to reflect new behavior Signed-off-by: Austin Abro <AustinAbro321@gmail.com> undo test config changes Signed-off-by: Austin Abro <AustinAbro321@gmail.com> remove extra whitespace Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
This commit is contained in:
parent
247cd7f1fa
commit
ab6d560002
|
@ -1,6 +1,7 @@
|
|||
name: tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'CHANGELOG.md'
|
||||
|
|
|
@ -171,7 +171,7 @@ func setupRegistryServer(ctx context.Context, workspaceDir string, opts registry
|
|||
}
|
||||
server.dnsServer.PatchNet(net.DefaultResolver)
|
||||
} else {
|
||||
server.registryHost = fmt.Sprintf("localhost:%d", port)
|
||||
server.registryHost = fmt.Sprintf("127.0.0.1:%d", port)
|
||||
}
|
||||
|
||||
config.HTTP.Addr = fmt.Sprintf(":%d", port)
|
||||
|
|
|
@ -162,7 +162,7 @@ func GetClientOpts(ctx context.Context, c client.Client, obj *helmv1.HelmReposit
|
|||
return nil, "", err
|
||||
}
|
||||
if loginOpt != nil {
|
||||
hrOpts.RegLoginOpts = []helmreg.LoginOption{loginOpt}
|
||||
hrOpts.RegLoginOpts = []helmreg.LoginOption{loginOpt, helmreg.LoginOptInsecure(obj.Spec.Insecure)}
|
||||
tlsLoginOpt := registry.TLSLoginOption(certFile, keyFile, caFile)
|
||||
if tlsLoginOpt != nil {
|
||||
hrOpts.RegLoginOpts = append(hrOpts.RegLoginOpts, tlsLoginOpt)
|
||||
|
|
|
@ -206,7 +206,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
|||
"password": []byte("pass"),
|
||||
},
|
||||
},
|
||||
loginOptsN: 2,
|
||||
loginOptsN: 3,
|
||||
},
|
||||
{
|
||||
name: "without caFile",
|
||||
|
@ -225,7 +225,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
|||
"password": []byte("pass"),
|
||||
},
|
||||
},
|
||||
loginOptsN: 1,
|
||||
loginOptsN: 2,
|
||||
},
|
||||
{
|
||||
name: "without cert secret",
|
||||
|
@ -239,7 +239,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
|||
"password": []byte("pass"),
|
||||
},
|
||||
},
|
||||
loginOptsN: 1,
|
||||
loginOptsN: 2,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
|
@ -280,7 +280,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
|||
}
|
||||
if tt.loginOptsN != len(clientOpts.RegLoginOpts) {
|
||||
// we should have a login option but no TLS option
|
||||
t.Error("registryTLSLoginOption() != nil")
|
||||
t.Errorf("expected length of %d for clientOpts.RegLoginOpts but got %d", tt.loginOptsN, len(clientOpts.RegLoginOpts))
|
||||
return
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue