Skip to content

Commit 3cdab83

Browse files
authored
feat: use resuming downloads for file downloader (#4415)
To tackle problems with low bandwidth networks and connectivity issues we can try using resuming downloads.
1 parent 0cc84af commit 3cdab83

File tree

9 files changed

+464
-121
lines changed

9 files changed

+464
-121
lines changed

Cargo.Bazel.Fuzzing.json.lock

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "bff29c17220de7fac8fd4a275c96c1b88ff7b1ecf5f0ef987bacf362e5044cff",
2+
"checksum": "68aa001ce9abfda2b276ee96f8a584a5fe878c7eef2f8817c1a4f6301cf09995",
33
"crates": {
44
"abnf 0.12.0": {
55
"name": "abnf",
@@ -21093,7 +21093,7 @@
2109321093
"target": "mockall"
2109421094
},
2109521095
{
21096-
"id": "mockito 1.2.0",
21096+
"id": "mockito 1.7.0",
2109721097
"target": "mockito"
2109821098
},
2109921099
{
@@ -31723,7 +31723,6 @@
3172331723
"common": [
3172431724
"client",
3172531725
"default",
31726-
"full",
3172731726
"h2",
3172831727
"http1",
3172931728
"http2",
@@ -46390,14 +46389,14 @@
4639046389
],
4639146390
"license_file": "LICENSE-APACHE"
4639246391
},
46393-
"mockito 1.2.0": {
46392+
"mockito 1.7.0": {
4639446393
"name": "mockito",
46395-
"version": "1.2.0",
46394+
"version": "1.7.0",
4639646395
"package_url": "https://github.com/lipanski/mockito",
4639746396
"repository": {
4639846397
"Http": {
46399-
"url": "https://static.crates.io/crates/mockito/1.2.0/download",
46400-
"sha256": "f8d3038e23466858569c2d30a537f691fa0d53b51626630ae08262943e3bbb8b"
46398+
"url": "https://static.crates.io/crates/mockito/1.7.0/download",
46399+
"sha256": "7760e0e418d9b7e5777c0374009ca4c93861b9066f18cb334a20ce50ab63aa48"
4640146400
}
4640246401
},
4640346402
"targets": [
@@ -46423,7 +46422,8 @@
4642346422
"common": [
4642446423
"color",
4642546424
"colored",
46426-
"default"
46425+
"default",
46426+
"parking_lot"
4642746427
],
4642846428
"selects": {}
4642946429
},
@@ -46433,24 +46433,44 @@
4643346433
"id": "assert-json-diff 2.0.2",
4643446434
"target": "assert_json_diff"
4643546435
},
46436+
{
46437+
"id": "bytes 1.9.0",
46438+
"target": "bytes"
46439+
},
4643646440
{
4643746441
"id": "colored 2.0.4",
4643846442
"target": "colored"
4643946443
},
4644046444
{
46441-
"id": "futures 0.3.31",
46442-
"target": "futures"
46445+
"id": "futures-util 0.3.31",
46446+
"target": "futures_util"
4644346447
},
4644446448
{
46445-
"id": "hyper 0.14.27",
46449+
"id": "http 1.2.0",
46450+
"target": "http"
46451+
},
46452+
{
46453+
"id": "http-body 1.0.1",
46454+
"target": "http_body"
46455+
},
46456+
{
46457+
"id": "http-body-util 0.1.2",
46458+
"target": "http_body_util"
46459+
},
46460+
{
46461+
"id": "hyper 1.5.1",
4644646462
"target": "hyper"
4644746463
},
46464+
{
46465+
"id": "hyper-util 0.1.10",
46466+
"target": "hyper_util"
46467+
},
4644846468
{
4644946469
"id": "log 0.4.20",
4645046470
"target": "log"
4645146471
},
4645246472
{
46453-
"id": "rand 0.8.5",
46473+
"id": "rand 0.9.0",
4645446474
"target": "rand"
4645546475
},
4645646476
{
@@ -46477,7 +46497,7 @@
4647746497
"selects": {}
4647846498
},
4647946499
"edition": "2021",
46480-
"version": "1.2.0"
46500+
"version": "1.7.0"
4648146501
},
4648246502
"license": "MIT",
4648346503
"license_ids": [
@@ -94417,7 +94437,7 @@
9441794437
"minicbor 0.19.1",
9441894438
"minicbor-derive 0.13.0",
9441994439
"mockall 0.13.0",
94420-
"mockito 1.2.0",
94440+
"mockito 1.7.0",
9442194441
"moka 0.12.8",
9442294442
"more-asserts 0.3.1",
9442394443
"nftables 0.4.1",

Cargo.Bazel.Fuzzing.toml.lock

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7726,16 +7726,21 @@ dependencies = [
77267726

77277727
[[package]]
77287728
name = "mockito"
7729-
version = "1.2.0"
7729+
version = "1.7.0"
77307730
source = "registry+https://github.com/rust-lang/crates.io-index"
7731-
checksum = "f8d3038e23466858569c2d30a537f691fa0d53b51626630ae08262943e3bbb8b"
7731+
checksum = "7760e0e418d9b7e5777c0374009ca4c93861b9066f18cb334a20ce50ab63aa48"
77327732
dependencies = [
77337733
"assert-json-diff",
7734+
"bytes",
77347735
"colored",
7735-
"futures",
7736-
"hyper 0.14.27",
7736+
"futures-util",
7737+
"http 1.2.0",
7738+
"http-body 1.0.1",
7739+
"http-body-util",
7740+
"hyper 1.5.1",
7741+
"hyper-util",
77377742
"log",
7738-
"rand 0.8.5",
7743+
"rand 0.9.0",
77397744
"regex",
77407745
"serde_json",
77417746
"serde_urlencoded",

Cargo.Bazel.json.lock

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"checksum": "6b5cac5f03c3f73653b9fcc13d0d44e0d958cc37cd309d006ec71b5733d99f13",
2+
"checksum": "0263b9a223c42fc2ecc48a3b8183818e33d79e8eb22e2726049e9d5495906a8c",
33
"crates": {
44
"abnf 0.12.0": {
55
"name": "abnf",
@@ -20921,7 +20921,7 @@
2092120921
"target": "mockall"
2092220922
},
2092320923
{
20924-
"id": "mockito 1.2.0",
20924+
"id": "mockito 1.7.0",
2092520925
"target": "mockito"
2092620926
},
2092720927
{
@@ -31578,7 +31578,6 @@
3157831578
"common": [
3157931579
"client",
3158031580
"default",
31581-
"full",
3158231581
"h2",
3158331582
"http1",
3158431583
"http2",
@@ -46230,14 +46229,14 @@
4623046229
],
4623146230
"license_file": "LICENSE-APACHE"
4623246231
},
46233-
"mockito 1.2.0": {
46232+
"mockito 1.7.0": {
4623446233
"name": "mockito",
46235-
"version": "1.2.0",
46234+
"version": "1.7.0",
4623646235
"package_url": "https://github.com/lipanski/mockito",
4623746236
"repository": {
4623846237
"Http": {
46239-
"url": "https://static.crates.io/crates/mockito/1.2.0/download",
46240-
"sha256": "f8d3038e23466858569c2d30a537f691fa0d53b51626630ae08262943e3bbb8b"
46238+
"url": "https://static.crates.io/crates/mockito/1.7.0/download",
46239+
"sha256": "7760e0e418d9b7e5777c0374009ca4c93861b9066f18cb334a20ce50ab63aa48"
4624146240
}
4624246241
},
4624346242
"targets": [
@@ -46263,7 +46262,8 @@
4626346262
"common": [
4626446263
"color",
4626546264
"colored",
46266-
"default"
46265+
"default",
46266+
"parking_lot"
4626746267
],
4626846268
"selects": {}
4626946269
},
@@ -46273,24 +46273,44 @@
4627346273
"id": "assert-json-diff 2.0.2",
4627446274
"target": "assert_json_diff"
4627546275
},
46276+
{
46277+
"id": "bytes 1.9.0",
46278+
"target": "bytes"
46279+
},
4627646280
{
4627746281
"id": "colored 2.0.4",
4627846282
"target": "colored"
4627946283
},
4628046284
{
46281-
"id": "futures 0.3.31",
46282-
"target": "futures"
46285+
"id": "futures-util 0.3.31",
46286+
"target": "futures_util"
4628346287
},
4628446288
{
46285-
"id": "hyper 0.14.27",
46289+
"id": "http 1.2.0",
46290+
"target": "http"
46291+
},
46292+
{
46293+
"id": "http-body 1.0.1",
46294+
"target": "http_body"
46295+
},
46296+
{
46297+
"id": "http-body-util 0.1.2",
46298+
"target": "http_body_util"
46299+
},
46300+
{
46301+
"id": "hyper 1.5.1",
4628646302
"target": "hyper"
4628746303
},
46304+
{
46305+
"id": "hyper-util 0.1.10",
46306+
"target": "hyper_util"
46307+
},
4628846308
{
4628946309
"id": "log 0.4.20",
4629046310
"target": "log"
4629146311
},
4629246312
{
46293-
"id": "rand 0.8.5",
46313+
"id": "rand 0.9.0",
4629446314
"target": "rand"
4629546315
},
4629646316
{
@@ -46317,7 +46337,7 @@
4631746337
"selects": {}
4631846338
},
4631946339
"edition": "2021",
46320-
"version": "1.2.0"
46340+
"version": "1.7.0"
4632146341
},
4632246342
"license": "MIT",
4632346343
"license_ids": [
@@ -94330,7 +94350,7 @@
9433094350
"minicbor 0.19.1",
9433194351
"minicbor-derive 0.13.0",
9433294352
"mockall 0.13.0",
94333-
"mockito 1.2.0",
94353+
"mockito 1.7.0",
9433494354
"moka 0.12.8",
9433594355
"more-asserts 0.3.1",
9433694356
"nftables 0.4.1",

Cargo.Bazel.toml.lock

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7717,16 +7717,21 @@ dependencies = [
77177717

77187718
[[package]]
77197719
name = "mockito"
7720-
version = "1.2.0"
7720+
version = "1.7.0"
77217721
source = "registry+https://github.com/rust-lang/crates.io-index"
7722-
checksum = "f8d3038e23466858569c2d30a537f691fa0d53b51626630ae08262943e3bbb8b"
7722+
checksum = "7760e0e418d9b7e5777c0374009ca4c93861b9066f18cb334a20ce50ab63aa48"
77237723
dependencies = [
77247724
"assert-json-diff",
7725+
"bytes",
77257726
"colored",
7726-
"futures",
7727-
"hyper 0.14.27",
7727+
"futures-util",
7728+
"http 1.2.0",
7729+
"http-body 1.0.1",
7730+
"http-body-util",
7731+
"hyper 1.5.1",
7732+
"hyper-util",
77287733
"log",
7729-
"rand 0.8.5",
7734+
"rand 0.9.0",
77307735
"regex",
77317736
"serde_json",
77327737
"serde_urlencoded",

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ memmap2 = "0.9.5"
624624
minicbor = { version = "0.19.1", features = ["alloc", "derive"] }
625625
minicbor-derive = "0.13.0"
626626
mockall = "0.13.0"
627-
mockito = "1.2.0"
627+
mockito = "1.6.1"
628628
nftables = "0.4"
629629
nix = { version = "0.24.3", features = ["ptrace"] }
630630
num_cpus = "1.16.0"

bazel/external_crates.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
838838
version = "^0.13.0",
839839
),
840840
"mockito": crate.spec(
841-
version = "^1.2.0",
841+
version = "^1.6.1",
842842
),
843843
"moka": crate.spec(
844844
version = "^0.12.8",

rs/http_utils/BUILD.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")
2+
load("//rs/tests:common.bzl", "MAINNET_ENV")
23

34
package(default_visibility = ["//visibility:public"])
45

@@ -37,3 +38,14 @@ rust_test(
3738
crate = ":http_utils",
3839
deps = DEPENDENCIES + DEV_DEPENDENCIES,
3940
)
41+
42+
rust_test(
43+
name = "resuming_download_test",
44+
srcs = glob(["tests/**/*.rs"]),
45+
env = MAINNET_ENV,
46+
tags = [
47+
"long_test", # this test doesn't necessarily take long but it downloads a big image from download proxy so, to save bandwidth, we don't want to do that for every update to every PR and only run this on pushes to master.
48+
"requires-network",
49+
],
50+
deps = DEPENDENCIES + DEV_DEPENDENCIES + [":http_utils"],
51+
)

0 commit comments

Comments
 (0)