~stub/slony-i/trunk

« back to all changes in this revision

Viewing changes to clustertest/disorder/tests/MultinodeCascadeFailover.js

  • Committer: Steve Singer
  • Date: 2017-04-25 12:16:19 UTC
  • Revision ID: git-v1:1585f5a793980ed3150d1cbfe20c0d23aa870ad3
failover unit test improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        this.prepareDb(['db6']);
26
26
        this.setupReplication();
27
27
 
 
28
 
 
29
 
28
30
        this.addCompletePaths();
29
31
        /**
30
32
         * Start the slons.
49
51
         *       5      6
50
52
         */
51
53
        this.subscribeSet(1,1, 1, [ 2, 3,4 ]);
52
 
        this.subscribeSet(1,1, 3, [ 5, 6 ]);
 
54
        this.subscribeSet(1,1, 3, [5,  6 ]);
53
55
        this.slonikSync(1,1);
 
56
        for(var j=1; j<100;j++) {
54
57
        var load = this.generateLoad();
55
58
        java.lang.Thread.sleep(10*1000);
56
59
        this.slonikSync(1,1);
57
 
        //stop slon 3, to make sure
 
60
        //stop slon 1, to make sure
58
61
        //3 and 5,6 aren't ahead of 2
59
62
        //If that happens nodes 5 might get unsubscribed
60
63
        //
61
 
        this.slonArray[3-1].stop();
62
 
        this.coordinator.join(this.slonArray[3-1]);
 
64
        this.slonArray[0].stop();
 
65
                this.coordinator.join(this.slonArray[0]);
 
66
        java.lang.Thread.sleep(20*1000);
63
67
        this.failover(1,2,3,5);
64
68
        /**
65
69
         * At the end of this we should have
79
83
        this.compareDb('db2','db5');
80
84
        this.compareDb('db2','db6');
81
85
        this.compareDb('db2','db4');
 
86
 
 
87
                if(this.testResults.getFailureCount() > 0) {
 
88
                        exit(-1);
 
89
                }
 
90
                this.dropTwoNodes(1,3,2);       
 
91
        this.reAddNode(1,2,2);
 
92
                this.reAddNode(3,2,2);
 
93
                this.slonikSync(1,2);
 
94
        this.addCompletePaths();
 
95
                this.moveSet(1,2,1);
 
96
                this.resubscribe(1,1,3);
 
97
    this.resubscribe(1,3,4);
 
98
    this.resubscribe(1,3,2);
 
99
        this.resubscribe(1,3,5);
 
100
        this.resubscribe(1,3,6);
 
101
        this.currentOrigin='db1';
 
102
        }//j
 
103
        this.unsubscribe(3,1);
 
104
        load=this.generateLoad();
 
105
        java.lang.Thread.sleep(1000*10);
 
106
        load.stop();    
 
107
        this.coordinator.join(load);
 
108
        this.slonikSync(1,2);
 
109
        //should fail.
 
110
        this.failover(2,3,5,1);
 
111
 
 
112
 
 
113
        
82
114
        for ( var idx = 1; idx <= this.getNodeCount(); idx++) {
83
115
                this.slonArray[idx - 1].stop();
84
116
                this.coordinator.join(this.slonArray[idx - 1]);         
85
117
        }
86
 
        this.dropDb(['db6']);
87
 
 
88
 
        
89
118
}
90
119
 
91
120
MultinodeCascadeFailover.prototype.failover=function(originA,backupA,originB,backupB)