Skip to content

Commit f646e45

Browse files
committed
tests: update download test to work with downloads_counter
1 parent a13b94e commit f646e45

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/tests/krate/downloads.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,24 @@ fn download() {
4242
// TODO: test the with_json code path
4343
};
4444

45+
let persist_downloads_count = || {
46+
app.as_inner()
47+
.downloads_counter
48+
.persist_all_shards(app.as_inner())
49+
.expect("failed to persist downloads count");
50+
};
51+
4552
download("foo_download/1.0.0");
53+
// No downloads are counted until the counters are persisted
54+
assert_dl_count("foo_download/1.0.0", None, 0);
55+
assert_dl_count("foo_download", None, 0);
56+
persist_downloads_count();
57+
// Now that the counters are persisted the download counts show up.
4658
assert_dl_count("foo_download/1.0.0", None, 1);
4759
assert_dl_count("foo_download", None, 1);
4860

4961
download("FOO_DOWNLOAD/1.0.0");
62+
persist_downloads_count();
5063
assert_dl_count("FOO_DOWNLOAD/1.0.0", None, 2);
5164
assert_dl_count("FOO_DOWNLOAD", None, 2);
5265

0 commit comments

Comments
 (0)