Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.


Browse files Browse the repository at this point in the history
Resolve flaky system test for counting image-rewrites on bursts of
requests by allowing 1 or 2 rewrites, instead of requiring 1.  Put in
comment explaining that this is due to 'best effort' locks.
  • Loading branch information
jmarantz committed Jan 14, 2016
1 parent b905d75 commit c368ef3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pagespeed/system/
Expand Up @@ -528,7 +528,12 @@ if [ $statistics_enabled = "1" ]; then

start_test A burst of image requests should yield only one rewrite.
# Ideally the system should only rewrite an image once when when it gets
# a burst of requests. A bug was fixed where we were not obeying a
# failed lock and were rewriting it potentially many times. It still
# happens fairly often that we rewrite the image twice. I am not sure
# why that is, except to observe that our locks are 'best effort'.
start_test A burst of image requests should yield only one two rewrites.
start_image_rewrites=$(scrape_stat image_rewrites)
echo Running burst of 20x: \"wget -q -O - $URL '|' wc -c\"
Expand All @@ -537,8 +542,8 @@ if [ $statistics_enabled = "1" ]; then
echo "... done"
sleep 1
end_image_rewrites=$(scrape_stat image_rewrites)
check [ $end_image_rewrites = $((start_image_rewrites + 1)) ]
num_image_rewrites=$(($(scrape_stat image_rewrites) - start_image_rewrites))
check [ $num_image_rewrites = 1 -o $num_image_rewrites = 2 ]

Expand Down

0 comments on commit c368ef3

Please sign in to comment.