Commit 489ea26b authored by shivanigithub's avatar shivanigithub Committed by Chromium LUCI CQ

Fix flaky disk cache size test

This CL fixes the flaky disk cache size test. The particular
flakiness resulted from off-by-one errors e.g.
Expected: (max_file_size_scaled) <= (2 * max_file_size),
actual: 55319511 vs 55319510
which occurred because file size is computed as (total cache size/8).

The fix however not just accounts for off-by-one errors but removes the
check completely as the total cache size is dependent on the available
disk space which cannot be guaranteed to be the same between the 2
invocations of VerifyDiskCacheSize.

Bug: 1162434
Change-Id: I510eed9ca0ed90e12e953910f7f699be74e10b14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2625350Reviewed-by: default avatarMaksim Orlovich <morlovich@chromium.org>
Commit-Queue: Shivani Sharma <shivanisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842715}
parent e1a95f33
......@@ -954,13 +954,14 @@ class DiskCacheSizeTest : public NetworkContextTest {
TEST_F(DiskCacheSizeTest, DiskCacheSize) {
int64_t max_file_size = VerifyDiskCacheSize();
// Scale to 200%. The size should be twice of |max_file_size| but
// since max size is capped on 20% of available size, checking for the size to
// be between max_file_size and max_file_size*2.
int64_t max_file_size_scaled = VerifyDiskCacheSize(200);
// After scaling to 200%, the size will in most cases be twice of
// |max_file_size| but it is dependent on the available size, and since we
// cannot guarantee available size to be the same between the 2 runs to
// VerifyDiskCacheSize(), only checking for the scaled size to be >=
// max_file_size.
EXPECT_GE(max_file_size_scaled, max_file_size);
EXPECT_LE(max_file_size_scaled, 2 * max_file_size);
}
// This makes sure that network_session_configurator::ChooseCacheType is
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment