Skip to content

Commit c78892e

Browse files
committed
fix test
1 parent 906c3fd commit c78892e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

modules/lfs/http_client_test.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"code.gitea.io/gitea/modules/json"
1515
"code.gitea.io/gitea/modules/setting"
16+
"code.gitea.io/gitea/modules/test"
1617

1718
"github.com/stretchr/testify/assert"
1819
)
@@ -212,37 +213,43 @@ func TestHTTPClientDownload(t *testing.T) {
212213
expectederror: "TransferAdapter not found: ",
213214
},
214215
// case 5
216+
{
217+
endpoint: "https://error-in-response-objects.io",
218+
expectederror: "Object not found",
219+
},
220+
// case 6
215221
{
216222
endpoint: "https://empty-actions-map.io",
217223
expectederror: "missing action 'download'",
218224
},
219-
// case 6
225+
// case 7
220226
{
221227
endpoint: "https://download-actions-map.io",
222228
expectederror: "",
223229
},
224-
// case 7
230+
// case 8
225231
{
226232
endpoint: "https://upload-actions-map.io",
227233
expectederror: "missing action 'download'",
228234
},
229-
// case 8
235+
// case 9
230236
{
231237
endpoint: "https://verify-actions-map.io",
232238
expectederror: "missing action 'download'",
233239
},
234-
// case 9
240+
// case 10
235241
{
236242
endpoint: "https://unknown-actions-map.io",
237243
expectederror: "missing action 'download'",
238244
},
239-
// case 10
245+
// case 11
240246
{
241247
endpoint: "https://legacy-batch-request-download.io",
242248
expectederror: "",
243249
},
244250
}
245251

252+
defer test.MockVariableValue(&setting.LFSClient.BatchOperationConcurrency, 1)()
246253
for n, c := range cases {
247254
client := &HTTPClient{
248255
client: hc,
@@ -251,7 +258,6 @@ func TestHTTPClientDownload(t *testing.T) {
251258
"dummy": dummy,
252259
},
253260
}
254-
setting.LFSClient.BatchOperationConcurrency = 1
255261

256262
err := client.Download(context.Background(), []Pointer{p}, func(p Pointer, content io.ReadCloser, objectError error) error {
257263
if objectError != nil {

0 commit comments

Comments
 (0)