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
|
name: tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- 'CHANGELOG.md'
|
- 'CHANGELOG.md'
|
||||||
|
|
|
@ -171,7 +171,7 @@ func setupRegistryServer(ctx context.Context, workspaceDir string, opts registry
|
||||||
}
|
}
|
||||||
server.dnsServer.PatchNet(net.DefaultResolver)
|
server.dnsServer.PatchNet(net.DefaultResolver)
|
||||||
} else {
|
} 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)
|
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
|
return nil, "", err
|
||||||
}
|
}
|
||||||
if loginOpt != nil {
|
if loginOpt != nil {
|
||||||
hrOpts.RegLoginOpts = []helmreg.LoginOption{loginOpt}
|
hrOpts.RegLoginOpts = []helmreg.LoginOption{loginOpt, helmreg.LoginOptInsecure(obj.Spec.Insecure)}
|
||||||
tlsLoginOpt := registry.TLSLoginOption(certFile, keyFile, caFile)
|
tlsLoginOpt := registry.TLSLoginOption(certFile, keyFile, caFile)
|
||||||
if tlsLoginOpt != nil {
|
if tlsLoginOpt != nil {
|
||||||
hrOpts.RegLoginOpts = append(hrOpts.RegLoginOpts, tlsLoginOpt)
|
hrOpts.RegLoginOpts = append(hrOpts.RegLoginOpts, tlsLoginOpt)
|
||||||
|
|
|
@ -206,7 +206,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
"password": []byte("pass"),
|
"password": []byte("pass"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
loginOptsN: 2,
|
loginOptsN: 3,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "without caFile",
|
name: "without caFile",
|
||||||
|
@ -225,7 +225,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
"password": []byte("pass"),
|
"password": []byte("pass"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
loginOptsN: 1,
|
loginOptsN: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "without cert secret",
|
name: "without cert secret",
|
||||||
|
@ -239,7 +239,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
"password": []byte("pass"),
|
"password": []byte("pass"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
loginOptsN: 1,
|
loginOptsN: 2,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -280,7 +280,7 @@ func TestGetClientOpts_registryTLSLoginOption(t *testing.T) {
|
||||||
}
|
}
|
||||||
if tt.loginOptsN != len(clientOpts.RegLoginOpts) {
|
if tt.loginOptsN != len(clientOpts.RegLoginOpts) {
|
||||||
// we should have a login option but no TLS option
|
// 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
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue