add disorder test for cleanup interval(bug 350)
authorSteve Singer <[email protected]>
Thu, 15 Jan 2015 20:30:21 +0000 (15:30 -0500)
committerSteve Singer <[email protected]>
Mon, 19 Jan 2015 13:16:11 +0000 (08:16 -0500)
clustertest/disorder/tests/CleanupInterval.js [new file with mode: 0644]
clustertest/disorder/tests/disorder_tests.js

diff --git a/clustertest/disorder/tests/CleanupInterval.js b/clustertest/disorder/tests/CleanupInterval.js
new file mode 100644 (file)
index 0000000..3598e89
--- /dev/null
@@ -0,0 +1,60 @@
+coordinator.includeFile('disorder/tests/BasicTest.js');
+
+CleanupInterval=function(coordinator,testResults) {
+       BasicTest.call(this,coordinator,testResults);
+    this.testDescription = 'This test exercieses the cleanup interval in the config file';
+}
+CleanupInterval.prototype = new BasicTest();
+CleanupInterval.prototype.constructor = EmptySet;
+
+
+
+
+CleanupInterval.prototype.runTest = function() {
+        this.coordinator.log("CleanupInterval.prototype.runTest - begin");
+
+       this.testResults.newGroup("Cleanup Interval");
+       this.setupReplication();
+       
+       var slonArray=[];        
+        
+    for(var idx=1; idx <= this.getNodeCount(); idx++) {
+       var confMap = this.getSlonConfFileMap(idx);
+       confMap.put('cleanup_interval','10');
+       slonArray[idx-1] = this.coordinator.createSlonLauncher('db' + idx,confMap);
+       slonArray[idx-1].run();
+       }
+       this.addTables();
+        this.coordinator.log("CleanupInterval.prototype.runTest - subscribe sets");
+       this.subscribeSet(1, 1,1,[2]);
+        this.slonikSync(1,1);
+       
+       var populate=this.generateLoad(1);
+       //sleep 1 minute, check that nothing sl_event from the origin is older than 50 seconds
+       var dbCon = this.coordinator.createJdbcConnection('db1');
+       var stat = dbCon.createStatement();
+
+       for(var cnt=0; cnt < 5;cnt++) {
+           java.lang.Thread.sleep(60*1000);
+           var  rs= stat.executeQuery("SELECT count(*) from _" + this.getClusterName() 
+                                      + ".sl_event where ev_origin=1 and ev_type='SYNC' and ev_timestamp<now()-'40 seconds'::interval");                           
+               rs.next();
+               this.testResults.assertCheck('no old events in sl_event',rs.getInt(1),0);
+               rs.close();     
+       }
+       stat.close();
+       dbCon.close();
+       populate.stop();
+       this.coordinator.join(populate);
+
+       for(var idx=1; idx <= this.getNodeCount(); idx++) {
+               slonArray[idx-1].stop();
+               this.coordinator.join(slonArray[idx-1]);        
+       }
+       
+        this.coordinator.log("CleanupInterval.prototype.runTest - complete");
+       
+}
+
+
+
index 6941a002ec12bde9df924c5f8ec0e834fc806b23..4f2f363d0085d9476e115b106d58dc06c75ab36b 100644 (file)
@@ -29,6 +29,7 @@ coordinator.includeFile('disorder/tests/MultinodeFailover.js');
 coordinator.includeFile('disorder/tests/Resubscribe.js');
 coordinator.includeFile('disorder/tests/SiteFailover.js');
 coordinator.includeFile('disorder/tests/DropNode.js');
+coordinator.includeFile('disorder/tests/CleanupInterval.js');
 
 var tests = 
     [new EmptySet(coordinator,results)
@@ -59,6 +60,7 @@ var tests =
         ,new Resubscribe(coordinator,results)
         ,new SiteFailover(coordinator,results)
         ,new DropNode(coordinator,results)
+        ,new CleanupInterval(coordinator,results)
         //Below tests are known to fail.
         //,new UnsubscribeBeforeEnable(coordinator,results)
      //,new DropSet(coordinator,results) //fails bug 133