mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-31 03:51:23 +01:00
Fix helmhub insecure issue when using with a proxy (#12014)
Signed-off-by: peimingming <peimingming@corp.netease.com>
This commit is contained in:
parent
9f5f8e4681
commit
7c2bfb1378
@ -37,7 +37,12 @@ func TestPrepareForPush(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHealthCheck(t *testing.T) {
|
||||
adapter, _ := newAdapter(nil)
|
||||
registry := &model.Registry{
|
||||
Type: model.RegistryTypeHelmHub,
|
||||
URL: baseURL,
|
||||
Insecure: true,
|
||||
}
|
||||
adapter, _ := newAdapter(registry)
|
||||
status, err := adapter.HealthCheck()
|
||||
require.Equal(t, model.Healthy, string(status))
|
||||
require.Nil(t, err)
|
||||
|
@ -23,7 +23,12 @@ import (
|
||||
)
|
||||
|
||||
func TestFetchCharts(t *testing.T) {
|
||||
adapter, err := newAdapter(nil)
|
||||
registry := &model.Registry{
|
||||
Type: model.RegistryTypeHelmHub,
|
||||
URL: baseURL,
|
||||
Insecure: false,
|
||||
}
|
||||
adapter, err := newAdapter(registry)
|
||||
require.Nil(t, err)
|
||||
// filter 1
|
||||
filters := []*model.Filter{
|
||||
@ -55,7 +60,12 @@ func TestFetchCharts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChartExist(t *testing.T) {
|
||||
adapter, err := newAdapter(nil)
|
||||
registry := &model.Registry{
|
||||
Type: model.RegistryTypeHelmHub,
|
||||
URL: baseURL,
|
||||
Insecure: false,
|
||||
}
|
||||
adapter, err := newAdapter(registry)
|
||||
require.Nil(t, err)
|
||||
exist, err := adapter.ChartExist("harbor/harbor", "1.0.0")
|
||||
require.Nil(t, err)
|
||||
@ -63,7 +73,12 @@ func TestChartExist(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChartExist2(t *testing.T) {
|
||||
adapter, err := newAdapter(nil)
|
||||
registry := &model.Registry{
|
||||
Type: model.RegistryTypeHelmHub,
|
||||
URL: baseURL,
|
||||
Insecure: false,
|
||||
}
|
||||
adapter, err := newAdapter(registry)
|
||||
require.Nil(t, err)
|
||||
exist, err := adapter.ChartExist("goharbor/harbor", "1.0.0")
|
||||
require.Nil(t, err)
|
||||
@ -75,7 +90,12 @@ func TestChartExist2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDownloadChart(t *testing.T) {
|
||||
adapter, err := newAdapter(nil)
|
||||
registry := &model.Registry{
|
||||
Type: model.RegistryTypeHelmHub,
|
||||
URL: baseURL,
|
||||
Insecure: false,
|
||||
}
|
||||
adapter, err := newAdapter(registry)
|
||||
require.Nil(t, err)
|
||||
_, err = adapter.DownloadChart("harbor/harbor", "1.0.0")
|
||||
require.Nil(t, err)
|
||||
|
@ -22,7 +22,7 @@ type Client struct {
|
||||
func NewClient(registry *model.Registry) *Client {
|
||||
return &Client{
|
||||
client: &http.Client{
|
||||
Transport: util.GetHTTPTransport(false),
|
||||
Transport: util.GetHTTPTransport(registry.Insecure),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user