diff options
author | Randolph Tan <randolph@10gen.com> | 2014-03-03 15:04:57 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2014-03-03 15:29:00 -0500 |
commit | f8534ae0d6c4e252d169c5bcf42f42cf6518ee7d (patch) | |
tree | e35db08d5d7ea3d70b6925f30bec0881efd2ee83 /jstests/dropdb_race.js | |
parent | 6a10de0bb8fe996daca5ecd5687f1072abb0dd8b (diff) | |
download | mongo-f8534ae0d6c4e252d169c5bcf42f42cf6518ee7d.tar.gz |
SERVER-12127 migrate js tests to jscore suite when not related to writes
Temporarily put back jstest in order not to lose test coverage
Diffstat (limited to 'jstests/dropdb_race.js')
-rw-r--r-- | jstests/dropdb_race.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/jstests/dropdb_race.js b/jstests/dropdb_race.js new file mode 100644 index 00000000000..bff7980011a --- /dev/null +++ b/jstests/dropdb_race.js @@ -0,0 +1,44 @@ +// test dropping a db with simultaneous commits + +m = db.getMongo(); +baseName = "jstests_dur_droprace"; +d = db.getSisterDB(baseName); +t = d.foo; + +assert(d.adminCommand({ setParameter: 1, syncdelay: 5 }).ok); + +var s = 0; + +var start = new Date(); + +for (var pass = 0; pass < 100; pass++) { + if (pass % 2 == 0) { + // sometimes wait for create db first, to vary the timing of things + t.insert({}); + if( pass % 4 == 0 ) + d.runCommand({getLastError:1,j:1}); + else + d.getLastError(); + } + t.insert({ x: 1 }); + t.insert({ x: 3 }); + t.ensureIndex({ x: 1 }); + sleep(s); + if (pass % 37 == 0) + d.adminCommand("closeAllDatabases"); + else if (pass % 13 == 0) + t.drop(); + else if (pass % 17 == 0) + t.dropIndexes(); + else + d.dropDatabase(); + if (pass % 7 == 0) + d.runCommand({getLastError:1,j:1}); + d.getLastError(); + s = (s + 1) % 25; + //print(pass); + if ((new Date()) - start > 60000) { + print("stopping early"); + break; + } +} |