mirror of
https://github.com/harness-community/drone-helm-chart-container-registry.git
synced 2026-06-04 10:15:18 +08:00
few fixes
This commit is contained in:
@@ -123,11 +123,6 @@ func registryLogin(args *Args, opts []registry.ClientOption) error {
|
||||
return fmt.Errorf("failed to create registry client")
|
||||
}
|
||||
|
||||
// mock registry
|
||||
if args.Username == "testUser" && args.Password == "testUser" && args.RegistryUrl == "https://test.hub.docker.com" {
|
||||
return nil
|
||||
}
|
||||
|
||||
cfg := new(action.Configuration)
|
||||
cfg.RegistryClient = registryClient
|
||||
|
||||
@@ -167,11 +162,6 @@ func registryPush(args *Args, opts []registry.ClientOption, packageRun string) e
|
||||
remoteURL = fmt.Sprintf("oci://%s/%s", args.RegistryUrl, args.Namespace)
|
||||
}
|
||||
|
||||
// mock registry
|
||||
if args.Username == "testUser" && args.Password == "testUser" && args.RegistryUrl == "https://test.hub.docker.com" {
|
||||
return nil
|
||||
}
|
||||
|
||||
_, err = client.Run(packageRun, remoteURL)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to push chart")
|
||||
|
||||
@@ -120,16 +120,6 @@ func TestRegistryLogin(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
// Test with mock registry
|
||||
err = registryLogin(&Args{
|
||||
RegistryUrl: "https://test.hub.docker.com",
|
||||
Username: "testUser",
|
||||
Password: "testUser",
|
||||
}, []registry.ClientOption{})
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryPush(t *testing.T) {
|
||||
@@ -144,14 +134,4 @@ func TestRegistryPush(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
// Test with mock registry
|
||||
err = registryPush(&Args{
|
||||
RegistryUrl: "https://test.hub.docker.com",
|
||||
Username: "testUser",
|
||||
Password: "testUser",
|
||||
}, []registry.ClientOption{}, "test-chart/chart-pass")
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user