mirror of https://github.com/artifacthub/hub.git
Request charts content uncompressed (#2969)
Fixes #2953 Signed-off-by: Sergio Castaño Arteaga <tegioz@icloud.com>
This commit is contained in:
parent
61701344a7
commit
11fb94e9e0
|
|
@ -534,7 +534,7 @@ func TestGetChartValues(t *testing.T) {
|
|||
hw.pm.On("Get", r.Context(), getPkgInput).Return(p1, nil)
|
||||
tgzReq, _ := http.NewRequest("GET", p1ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(r.Context())
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
f, _ := os.Open("testdata/pkg2-1.0.0.tgz")
|
||||
hw.hc.On("Do", tgzReq).Return(&http.Response{
|
||||
Body: f,
|
||||
|
|
@ -558,7 +558,7 @@ func TestGetChartValues(t *testing.T) {
|
|||
hw.pm.On("Get", r.Context(), getPkgInput).Return(p1, nil)
|
||||
tgzReq, _ := http.NewRequest("GET", p1ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(r.Context())
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
f, _ := os.Open("testdata/pkg1-1.0.0.tgz")
|
||||
hw.hc.On("Do", tgzReq).Return(&http.Response{
|
||||
Body: f,
|
||||
|
|
@ -624,7 +624,7 @@ func TestGetChartTemplates(t *testing.T) {
|
|||
hw.pm.On("Get", r.Context(), getPkgInput).Return(p1, nil)
|
||||
tgzReq, _ := http.NewRequest("GET", p1ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(r.Context())
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
f, _ := os.Open("testdata/pkg1-1.0.0.tgz")
|
||||
hw.hc.On("Do", tgzReq).Return(&http.Response{
|
||||
Body: f,
|
||||
|
|
@ -1762,7 +1762,7 @@ func TestGetChartArchive(t *testing.T) {
|
|||
hw.pm.On("Get", ctx, getPkgInput).Return(p1, nil)
|
||||
tgzReq, _ := http.NewRequest("GET", p1ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(ctx)
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
hw.hc.On("Do", tgzReq).Return(tc.resp, tc.err)
|
||||
chrt, err := hw.h.getChartArchive(ctx, packageID, version)
|
||||
|
||||
|
|
@ -1795,7 +1795,7 @@ func TestGetChartArchive(t *testing.T) {
|
|||
hw.pm.On("Get", ctx, getPkgInput).Return(p1, nil)
|
||||
tgzReq, _ := http.NewRequest("GET", p1ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(ctx)
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
hw.hc.On("Do", tgzReq).Return(&http.Response{
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
StatusCode: http.StatusOK,
|
||||
|
|
@ -1814,7 +1814,7 @@ func TestGetChartArchive(t *testing.T) {
|
|||
hw.pm.On("Get", ctx, getPkgInput).Return(p1, nil)
|
||||
tgzReq, _ := http.NewRequest("GET", p1ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(ctx)
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
f, _ := os.Open("testdata/pkg1-1.0.0.tgz")
|
||||
hw.hc.On("Do", tgzReq).Return(&http.Response{
|
||||
Body: f,
|
||||
|
|
@ -1839,7 +1839,7 @@ func TestGetChartArchive(t *testing.T) {
|
|||
tgzReq, _ := http.NewRequest("GET", p2ContentURL, nil)
|
||||
tgzReq = tgzReq.WithContext(ctx)
|
||||
tgzReq.SetBasicAuth("user", "pass")
|
||||
tgzReq.Header.Set("Accept-Encoding", "*")
|
||||
tgzReq.Header.Set("Accept-Encoding", "identity")
|
||||
f, _ := os.Open("testdata/pkg1-1.0.0.tgz")
|
||||
hw.hc.On("Do", tgzReq).Return(&http.Response{
|
||||
Body: f,
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ func LoadChartArchive(ctx context.Context, u *url.URL, o *LoadChartArchiveOption
|
|||
// Get chart content
|
||||
req, _ := http.NewRequest("GET", u.String(), nil)
|
||||
req = req.WithContext(ctx)
|
||||
req.Header.Set("Accept-Encoding", "*")
|
||||
req.Header.Set("Accept-Encoding", "identity")
|
||||
if o.Username != "" || o.Password != "" {
|
||||
req.SetBasicAuth(o.Username, o.Password)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ func TestTrackerSource(t *testing.T) {
|
|||
},
|
||||
}, "", nil)
|
||||
req, _ := http.NewRequest("GET", "https://repo.url/pkg1-1.0.0.tgz", nil)
|
||||
req.Header.Set("Accept-Encoding", "*")
|
||||
req.Header.Set("Accept-Encoding", "identity")
|
||||
sw.Hc.On("Do", req).Return(nil, tests.ErrFake)
|
||||
expectedErr := "error preparing package: error loading chart (https://repo.url/pkg1-1.0.0.tgz): fake error for tests (package: pkg1 version: 1.0.0)"
|
||||
sw.Ec.On("Append", i.Repository.RepositoryID, expectedErr).Return()
|
||||
|
|
@ -343,7 +343,7 @@ func TestTrackerSource(t *testing.T) {
|
|||
},
|
||||
}, "", nil)
|
||||
req, _ := http.NewRequest("GET", "https://repo.url/pkg1-1.0.0.tgz", nil)
|
||||
req.Header.Set("Accept-Encoding", "*")
|
||||
req.Header.Set("Accept-Encoding", "identity")
|
||||
sw.Hc.On("Do", req).Return(&http.Response{
|
||||
Body: io.NopCloser(strings.NewReader("")),
|
||||
StatusCode: http.StatusNotFound,
|
||||
|
|
@ -417,7 +417,7 @@ func TestTrackerSource(t *testing.T) {
|
|||
}, "", nil)
|
||||
f, _ := os.Open("testdata/pkg1-1.0.0.tgz")
|
||||
reqChart, _ := http.NewRequest("GET", "https://repo.url/pkg1-1.0.0.tgz", nil)
|
||||
reqChart.Header.Set("Accept-Encoding", "*")
|
||||
reqChart.Header.Set("Accept-Encoding", "identity")
|
||||
sw.Hc.On("Do", reqChart).Return(&http.Response{
|
||||
Body: f,
|
||||
StatusCode: http.StatusOK,
|
||||
|
|
@ -474,7 +474,7 @@ func TestTrackerSource(t *testing.T) {
|
|||
}, "", nil)
|
||||
f, _ := os.Open("testdata/pkg1-1.0.0.tgz")
|
||||
reqChart, _ := http.NewRequest("GET", "https://repo.url/pkg1-1.0.0.tgz", nil)
|
||||
reqChart.Header.Set("Accept-Encoding", "*")
|
||||
reqChart.Header.Set("Accept-Encoding", "identity")
|
||||
sw.Hc.On("Do", reqChart).Return(&http.Response{
|
||||
Body: f,
|
||||
StatusCode: http.StatusOK,
|
||||
|
|
|
|||
Loading…
Reference in New Issue