Skip to content

Commit

Permalink
Retries in cache test
Browse files Browse the repository at this point in the history
  • Loading branch information
noamr authored and sideshowbarker committed Jan 18, 2023
1 parent 8f2af79 commit 8ae3007
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion preload/prefetch-cache.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
}

promise_test(async t => {
const result = await prefetch_and_count("max-age=604800", t);
let result = 0;
// Sometimes the HTTP cache is not reliable. We want to see that the prefetch is reused in at
// least 1 out of 10 tries.
for (let i = 0; i < 10 && result !== 1; ++i) {
result = await prefetch_and_count("max-age=604800", t);
}
assert_equals(result, 1);
}, "Prefetch should populate the HTTP cache");

Expand Down

0 comments on commit 8ae3007

Please sign in to comment.