Mercurial > hg-stable
changeset 23233:c1f370dab456
discovery: test coverage for issue4438 / 86c35b7ae300 / 73cfaa348650
The randomness in the discovery protocol made this problem hard to reproduce.
The test mocks random.sample to make sure we hit the problem every time. The
set iteration order also made the output unstable ... but with the issue fixed,
it is stable.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 06 Nov 2014 01:48:29 +0100 |
parents | 7f4f4217c924 |
children | 944d6cfbe166 |
files | tests/bundles/issue4438-r1.hg tests/bundles/issue4438-r2.hg tests/test-setdiscovery.t |
diffstat | 3 files changed, 49 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-setdiscovery.t Tue Nov 04 21:45:26 2014 -0800 +++ b/tests/test-setdiscovery.t Thu Nov 06 01:48:29 2014 +0100 @@ -357,3 +357,52 @@ $ cat errors.log $ cd .. + + +Issue 4438 - test coverage for 3ef893520a85 issues. + + $ mkdir issue4438 + $ cd issue4438 +#if false +generate new bundles: + $ hg init r1 + $ for i in `seq 101`; do hg -R r1 up -qr null && hg -R r1 branch -q b$i && hg -R r1 ci -qmb$i; done + $ hg clone -q r1 r2 + $ for i in `seq 10`; do hg -R r1 up -qr null && hg -R r1 branch -q c$i && hg -R r1 ci -qmc$i; done + $ hg -R r2 branch -q r2change && hg -R r2 ci -qmr2change + $ hg -R r1 bundle -qa $TESTDIR/bundles/issue4438-r1.hg + $ hg -R r2 bundle -qa $TESTDIR/bundles/issue4438-r2.hg +#else +use existing bundles: + $ hg clone -q $TESTDIR/bundles/issue4438-r1.hg r1 + $ hg clone -q $TESTDIR/bundles/issue4438-r2.hg r2 +#endif + +Set iteration order could cause wrong and unstable results - fixed in 73cfaa348650: + + $ hg -R r1 outgoing r2 -T'{rev} ' + comparing with r2 + searching for changes + 101 102 103 104 105 106 107 108 109 110 (no-eol) + +The case where all the 'initialsamplesize' samples already were common would +give 'all remote heads known locally' without checking the remaining heads - +fixed in 86c35b7ae300: + + $ cat >> $TESTTMP/unrandomsample.py << EOF + > import random + > def sample(population, k): + > return sorted(population)[:k] + > random.sample = sample + > EOF + + $ cat >> r1/.hg/hgrc << EOF + > [extensions] + > unrandomsample = $TESTTMP/unrandomsample.py + > EOF + + $ hg -R r1 outgoing r2 -T'{rev} ' + comparing with r2 + searching for changes + 101 102 103 104 105 106 107 108 109 110 (no-eol) + $ cd ..