mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
make shellkillop test more robust
This commit is contained in:
parent
33d8cd8302
commit
c424e28a2f
@ -1,5 +1,10 @@
|
|||||||
baseName = "jstests_shellkillop";
|
baseName = "jstests_shellkillop";
|
||||||
|
|
||||||
|
// 'retry' should be set to true in contexts where an exception should cause the test to be retried rather than to fail.
|
||||||
|
retry = true;
|
||||||
|
|
||||||
|
function testShellAutokillop() {
|
||||||
|
|
||||||
if (_isWindows()) {
|
if (_isWindows()) {
|
||||||
print("shellkillop.js not testing on windows, as functionality is missing there");
|
print("shellkillop.js not testing on windows, as functionality is missing there");
|
||||||
print("shellkillop.js see http://jira.mongodb.org/browse/SERVER-1451");
|
print("shellkillop.js see http://jira.mongodb.org/browse/SERVER-1451");
|
||||||
@ -20,7 +25,9 @@ else {
|
|||||||
spawn = startMongoProgramNoConnect("mongo", "--autokillop", "--port", myPort(), "--eval", evalStr);
|
spawn = startMongoProgramNoConnect("mongo", "--autokillop", "--port", myPort(), "--eval", evalStr);
|
||||||
|
|
||||||
sleep(100);
|
sleep(100);
|
||||||
|
retry = true;
|
||||||
assert(db[baseName].find({ i: 'abcdefghijkl' }).count() < 100000, "update ran too fast, test won't be valid");
|
assert(db[baseName].find({ i: 'abcdefghijkl' }).count() < 100000, "update ran too fast, test won't be valid");
|
||||||
|
retry = false;
|
||||||
|
|
||||||
stopMongoProgramByPid(spawn);
|
stopMongoProgramByPid(spawn);
|
||||||
|
|
||||||
@ -34,7 +41,25 @@ else {
|
|||||||
throw "shellkillop.js op is still running: " + tojson( inprog[i] );
|
throw "shellkillop.js op is still running: " + tojson( inprog[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retry = true;
|
||||||
assert(db[baseName].find({ i: 'abcdefghijkl' }).count() < 100000, "update ran too fast, test was not valid");
|
assert(db[baseName].find({ i: 'abcdefghijkl' }).count() < 100000, "update ran too fast, test was not valid");
|
||||||
|
retry = false;
|
||||||
print("shellkillop.js SUCCESS");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
for( var nTries = 0; nTries < 10 && retry; ++nTries ) {
|
||||||
|
try {
|
||||||
|
testShellAutokillop();
|
||||||
|
} catch (e) {
|
||||||
|
if ( !retry ) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
printjson( e );
|
||||||
|
print( "retrying..." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert( !retry, "retried too many times" );
|
||||||
|
|
||||||
|
print("shellkillop.js SUCCESS");
|
||||||
|
Loading…
Reference in New Issue
Block a user