summaryrefslogtreecommitdiff
path: root/jstests/multiVersion/1_test_launching_replset.js
blob: af1bdf6b33092e884dbfc7dd061014f8927cf515 (plain)
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
//
// Tests launching multi-version ReplSetTest replica sets
//

// Check our latest versions
var versionsToCheck = [ "last-stable",
                        "latest" ];

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

jsTest.log( "Testing legacy versions..." );

for( var i = 0; i < versionsToCheck.length; i++ ){

    var version = versionsToCheck[ i ];
    
    // Set up a replica set
    
    var rst = new ReplSetTest({ nodes : 2 });
    
    rst.startSet({ binVersion : version });
        
    var nodes = rst.nodes;
    
    // Make sure the started versions are actually the correct versions
    for( var j = 0; j < nodes.length; j++ ) assert.binVersion(nodes[j], version);
    
    rst.stopSet();
}

jsTest.log( "Testing mixed versions..." );

// Set up a multi-version replica set

var rst = new ReplSetTest({ nodes : 2 });

rst.startSet({ binVersion : versionsToCheck });

var nodes = rst.nodes;

//Make sure we have hosts of all the different versions
var versionsFound = [];
for( var j = 0; j < nodes.length; j++ )
    versionsFound.push(nodes[j].getBinVersion());

assert.allBinVersions(versionsToCheck, versionsFound);

rst.stopSet();

jsTest.log( "Done!" );

//
// End
//