failover unit test improvements
authorSteve Singer <ssinger@ca.afilias.info>
Tue, 25 Apr 2017 12:16:19 +0000 (08:16 -0400)
committerSteve Singer <ssinger@ca.afilias.info>
Tue, 25 Apr 2017 12:16:19 +0000 (08:16 -0400)
clustertest/disorder/tests/BasicTest.js
clustertest/disorder/tests/FailNodeTest.js
clustertest/disorder/tests/MultinodeCascadeFailover.js
clustertest/disorder/tests/MultinodeFailover.js

index 7abb6080ec081dae6a97e788533d5bc4d0f8f16c..ee41110e748042f0e0dbb58d1ff6f0b119d1737a 100644 (file)
@@ -810,4 +810,31 @@ BasicTest.prototype.updateReviewTable=function(node_id,text) {
                stat.close();
                connection.close();
        }
-       this.coordinator.log('updating review table on ' + node_id + " - complete");}
\ No newline at end of file
+       this.coordinator.log('updating review table on ' + node_id + " - complete");
+}
+
+BasicTest.prototype.unsubscribe=function(node,set)
+{
+       var slonikPreamble = this.getSlonikPreamble();
+       var slonikScript = 'echo \'BasicTest.prototype.unsubscribe\';\n';
+       slonikScript += 'UNSUBSCRIBE SET(id='  + set  + ',receiver=' + node +');\n';
+       var slonik=this.coordinator.createSlonik('unsubscribe',slonikPreamble,slonikScript);
+       slonik.run();
+       this.coordinator.join(slonik);
+       this.testResults.assertCheck('unsubscribe passes',slonik.getReturnCode(),0);    
+
+}
+
+BasicTest.prototype.resubscribe=function(origin,provider,receiver)
+{
+       var slonikPreamble = this.getSlonikPreamble();
+       var slonikScript = 'echo \'BasicTest.prototype.resubscribe\';\n';
+       var slonikScript = 'resubscribe node(origin=' + origin + ',provider='
+               +provider + ',receiver=' + receiver+');\n';
+               
+       var slonik=this.coordinator.createSlonik('unsubscribe',slonikPreamble,slonikScript);
+       slonik.run();
+       this.coordinator.join(slonik);
+       this.testResults.assertCheck('resubscribe passes',slonik.getReturnCode(),0);    
+
+}
index c3936c021c80c512648a52da8f8ff955692f531b..6b67eab60abe426d39abf158795b20ebe627260b 100644 (file)
@@ -292,7 +292,6 @@ FailNodeTest.prototype.reAddNode = function(node_id,origin,provider) {
        var slonik=this.coordinator.createSlonik('re-add node',slonikPreamble,slonikScript);
        slonik.run();
        this.coordinator.join(slonik);
-       
        slonikScript =  'store node(id=' + node_id + ',event node=' + provider+');\n' 
                + 'store path(server=' + node_id + ',client=' + provider
                + ',conninfo=@CONNINFO' + node_id+');\n'
index 8d1599e8498cbdf9167a7d1968f40c37d2318ed3..4c7d1572cfe347d88de5b05173dc58abd66bf996 100644 (file)
@@ -25,6 +25,8 @@ MultinodeCascadeFailover.prototype.runTest = function() {
        this.prepareDb(['db6']);
        this.setupReplication();
 
+
+
        this.addCompletePaths();
        /**
         * Start the slons.
@@ -49,17 +51,19 @@ MultinodeCascadeFailover.prototype.runTest = function() {
         *       5      6
         */
        this.subscribeSet(1,1, 1, [ 2, 3,4 ]);
-       this.subscribeSet(1,1, 3, [ 5, 6 ]);
+       this.subscribeSet(1,1, 3, [5,  6 ]);
        this.slonikSync(1,1);
+       for(var j=1; j<100;j++) {
        var load = this.generateLoad();
        java.lang.Thread.sleep(10*1000);
        this.slonikSync(1,1);
-       //stop slon 3, to make sure
+       //stop slon 1, to make sure
        //3 and 5,6 aren't ahead of 2
        //If that happens nodes 5 might get unsubscribed
        //
-       this.slonArray[3-1].stop();
-       this.coordinator.join(this.slonArray[3-1]);
+       this.slonArray[0].stop();
+               this.coordinator.join(this.slonArray[0]);
+       java.lang.Thread.sleep(20*1000);
        this.failover(1,2,3,5);
        /**
         * At the end of this we should have
@@ -79,13 +83,38 @@ MultinodeCascadeFailover.prototype.runTest = function() {
        this.compareDb('db2','db5');
        this.compareDb('db2','db6');
        this.compareDb('db2','db4');
+
+               if(this.testResults.getFailureCount() > 0) {
+                       exit(-1);
+               }
+               this.dropTwoNodes(1,3,2);       
+       this.reAddNode(1,2,2);
+               this.reAddNode(3,2,2);
+               this.slonikSync(1,2);
+       this.addCompletePaths();
+               this.moveSet(1,2,1);
+               this.resubscribe(1,1,3);
+    this.resubscribe(1,3,4);
+    this.resubscribe(1,3,2);
+       this.resubscribe(1,3,5);
+       this.resubscribe(1,3,6);
+       this.currentOrigin='db1';
+       }//j
+       this.unsubscribe(3,1);
+       load=this.generateLoad();
+       java.lang.Thread.sleep(1000*10);
+       load.stop();    
+       this.coordinator.join(load);
+       this.slonikSync(1,2);
+       //should fail.
+       this.failover(2,3,5,1);
+
+
+       
        for ( var idx = 1; idx <= this.getNodeCount(); idx++) {
                this.slonArray[idx - 1].stop();
                this.coordinator.join(this.slonArray[idx - 1]);         
        }
-       this.dropDb(['db6']);
-
-       
 }
 
 MultinodeCascadeFailover.prototype.failover=function(originA,backupA,originB,backupB) 
index ae94a26da981a98fe37144cd74dd7c80d2b6c1aa..5f470b92756c435223a433864cb7b8be55a36622 100644 (file)
@@ -141,14 +141,11 @@ MultinodeFailover.prototype.runTest = function() {
     this.moveSet(1,1,2);
        this.dropNode(5,1);
        this.nodeCount=4;
-       var resubscribeSlonik = 'resubscribe node(origin=2,provider=2,receiver=1);\n'
-               + 'resubscribe node(origin=2,provider=2,receiver=3);\n'
-           + 'resubscribe node(origin=2,provider=3,receiver=4);\n';
-       var slonikPreamble = this.getSlonikPreamble();
-       var slonik=this.coordinator.createSlonik('failover',slonikPreamble,resubscribeSlonik);
-       slonik.run();
-       this.coordinator.join(slonik);
-       this.testResults.assertCheck('failover passes',slonik.getReturnCode(),0);       
+       this.resubscribe(2,2,1);
+       this.resubscribe(2,2,3);
+       this.resubscribe(2,3,4);
+       
+       
        this.currentOrigin='db2';
        load=this.generateLoad();
        java.lang.Thread.sleep(1000);