File: config_version_excludes.js

package info (click to toggle)
mongodb 1%3A2.4.10-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 82,464 kB
  • sloc: cpp: 740,225; ansic: 152,098; sh: 13,820; python: 11,864; makefile: 1,012; perl: 922; pascal: 617; java: 452; lisp: 222; asm: 174
file content (68 lines) | stat: -rw-r--r-- 2,109 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
// Test checks whether or not config version excludes prevent mongos startup
//

load('./jstests/multiVersion/libs/verify_versions.js');

jsTest.log( "Starting cluster..." );

var options = {
               
    mongosOptions : { },
    configOptions : {  },
    shardOptions : { },
    
    separateConfig : true,
    sync : false
}

var st = new ShardingTest({ shards : 2, mongos : 3, other : options });

var mongos = st.s0
var parallelMongoses = st._mongos.concat([]).splice(1);
var config = mongos.getDB("config")
var configVersion = config.getMongo().getCollection("config.version");
var admin = mongos.getDB("admin")

var configConnStr = st._configDB;

// Make sure adding an excluded version actually prevents mongos from starting

jsTest.log("Testing excluded mongos versions...")

// Since the version isn't being tested via javascript, we want to find the actual version
// that "latest" is mapped to.
// Implicitly, the above cluster is started at "latest" version, so we can check this way.
var realLatestVersion = mongos.getBinVersion();

configVersion.update({ _id : 1 }, { $addToSet : { excluding : realLatestVersion } });
printjson(configVersion.findOne());

// Make sure down
var mongosNew = MongoRunner.runMongos({ binVersion : "latest", configdb : configConnStr })
assert.eq(null, mongosNew);

jsTest.log("Testing excluded ranges...")

configVersion.update({ _id : 1 }, { $unset : { excluding : 1 } });
configVersion.update({ _id : 1 }, { $addToSet : { excluding : ["1.8", 
                                                               realLatestVersion] } });
printjson(configVersion.findOne());

// Make sure down
var mongosNew = MongoRunner.runMongos({ binVersion : "latest", configdb : configConnStr })
assert.eq(null, mongosNew);

jsTest.log("Testing empty excluded...")

configVersion.update({ _id : 1 }, { $unset : { excluding : 1 } });
printjson(configVersion.findOne());

// Make sure up
var mongosNew = MongoRunner.runMongos({ binVersion : "latest", configdb : configConnStr })
assert.neq(null, mongosNew);
MongoRunner.stopMongos(mongosNew);

jsTest.log("DONE!")

st.stop();