~ubuntu-branches/ubuntu/wily/mongodb/wily

« back to all changes in this revision

Viewing changes to jstests/replsets/chaining.js

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-26 09:41:32 UTC
  • mfrom: (1.2.25)
  • Revision ID: package-import@ubuntu.com-20130826094132-8cknfm4syxyip1zt
Tags: 1:2.4.6-0ubuntu1
* New upstream point release.
* d/control,d/tests/*: Add autopkgtests for server process and client
  shell functionality.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Test that chaining position propegation (percolate) still works properly 
2
 
// in the face of socket exceptions
3
 
 
4
 
function assertGLEOK(status) {
5
 
    assert(status.ok && status.err === null,
6
 
           "Expected OK status object; found " + tojson(status));
7
 
}
8
 
 
9
 
var replTest = new ReplSetTest({name: 'testSet', nodes: 3});
10
 
var nodes = replTest.startSet();
11
 
var hostnames = replTest.nodeList();
12
 
replTest.initiate(
13
 
    {
14
 
        "_id" : "testSet",
15
 
        "members" : [
16
 
            {"_id" : 0, "host" : hostnames[0], "priority" : 2},
17
 
            {"_id" : 1, "host" : hostnames[1]},
18
 
            {"_id" : 2, "host" : hostnames[2]}
19
 
        ],
20
 
    }
21
 
);
22
 
 
23
 
replTest.awaitReplication();
24
 
 
25
 
replTest.bridge();
26
 
replTest.partition(0, 2);
27
 
 
28
 
// Now 0 and 2 can't see each other, so 2 should chain through 1 to reach 0.
29
 
 
30
 
var master = replTest.getMaster();
31
 
var cdb = master.getDB("chaining");
32
 
var admin = nodes[1].getDB("admin");
33
 
cdb.foo.insert({a:1});
34
 
assertGLEOK(cdb.getLastErrorObj());
35
 
replTest.awaitReplication();
36
 
 
37
 
var result = admin.runCommand( { configureFailPoint: 'rsChaining1', mode: { times : 1 } } );
38
 
assert.eq(1, result.ok, 'rsChaining1');
39
 
cdb.foo.insert({a:1});
40
 
assertGLEOK(cdb.getLastErrorObj());
41
 
replTest.awaitReplication();
42
 
admin.runCommand( { configureFailPoint: 'rsChaining2', mode: { times : 1 } } );
43
 
assert.eq(1, result.ok, 'rsChaining2');
44
 
cdb.foo.insert({a:1});
45
 
assertGLEOK(cdb.getLastErrorObj());
46
 
replTest.awaitReplication();
47
 
admin.runCommand( { configureFailPoint: 'rsChaining3', mode: { times : 1 } } );
48
 
assert.eq(1, result.ok, 'rsChaining3');
49
 
cdb.foo.insert({a:1});
50
 
assertGLEOK(cdb.getLastErrorObj());
51
 
replTest.awaitReplication();
52
 
replTest.stopSet();