This test is (in 10.0.2 at least) unstable. Sometimes SELECT returns incorrect number of pages, namely from before the operation. But if the test is modified to repeat the same SELECT many (e.g. 10) times, then one can see that the number of pages eventually changes to the correct one. There's obviously a race condition here.
One way of fixing the test is to use include/wait_condition.inc and wait for the number of pages to reach the correct value. If the test times out, it would mean a bug.