From 40b5cd2b8b958ef572e27fb461d143d8b4fd24d1 Mon Sep 17 00:00:00 2001 From: Steve Singer Date: Fri, 5 Aug 2011 14:25:03 -0400 Subject: [PATCH 1/3] Adding a test file to verify some of the implicit wait for behaviour --- clustertest/disorder/tests/WaitForTest.js | 72 ++++++++++++++++++++++++++ clustertest/disorder/tests/disorder_tests.js | 4 +- 2 files changed, 75 insertions(+), 1 deletions(-) create mode 100644 clustertest/disorder/tests/WaitForTest.js diff --git a/clustertest/disorder/tests/WaitForTest.js b/clustertest/disorder/tests/WaitForTest.js new file mode 100644 index 0000000..a8c0449 --- /dev/null +++ b/clustertest/disorder/tests/WaitForTest.js @@ -0,0 +1,72 @@ +/** + * Tests implicit WAIT FOR behaviour. + * + */ +coordinator.includeFile('disorder/tests/BasicTest.js'); + +WaitForTest = function(coordinator, testResults) { + ExecuteScript.call(this, coordinator, testResults); + this.testDescription='Tests the implicit wait for behaviour'; +} +WaitForTest.prototype = new ExecuteScript(); +WaitForTest.prototype.constructor = WaitForTest; + +WaitForTest.prototype.runTest = function() { + this.coordinator.log("WaitForTest.prototype.runTest - begin"); + + this.testResults.newGroup("WaitForTest"); + this.setupReplication(); + + /** + * Start the slons. + */ + var slonArray = []; + for ( var idx = 1; idx <= this.getNodeCount(); idx++) { + slonArray[idx - 1] = this.coordinator.createSlonLauncher('db' + idx); + slonArray[idx - 1].run(); + } + this.slonikSync(1,1); + for ( var idx = 1; idx <= this.getNodeCount(); idx++) { + slonArray[idx - 1].stop(); + this.coordinator.join(slonArray[idx - 1]); + } + + /** + * add a second replication set + */ + var slonikPreamble = this.getSlonikPreamble(); + var slonikScript = 'echo \'BasicTest.prototype.createSecondSet\';\n'; + slonikScript += 'create set(id=2, origin=2 ,comment=\'second set\');\n' + +"create set(id=3, origin=3 ,comment=\'second set\');\n';"; + + var slonik = this.coordinator.createSlonik('create second set', + slonikPreamble, + slonikScript); + slonik.run(); + /** + * slonik should not finish, it should be waiting in an implicit + * wait for. + */ + java.lang.Thread.sleep(60*1000); + this.testResults.assertCheck('slonik waiting',slonik.isFinished(),false); + + + /** + * Start the slons. + **/ + var slonArray = []; + for ( var idx = 1; idx <= this.getNodeCount(); idx++) { + slonArray[idx - 1] = this.coordinator.createSlonLauncher('db' + idx); + slonArray[idx - 1].run(); + } + + this.coordinator.join(slonik); + this.testResults.assertCheck('slonik finished okay',slonik.getReturnCode(), + 0); + for ( var idx = 1; idx <= this.getNodeCount(); idx++) { + slonArray[idx - 1].stop(); + this.coordinator.join(slonArray[idx - 1]); + } + + this.coordinator.log("WiatForTest.prototype.runTest - complete"); +} \ No newline at end of file diff --git a/clustertest/disorder/tests/disorder_tests.js b/clustertest/disorder/tests/disorder_tests.js index 20408fb..bf3449f 100644 --- a/clustertest/disorder/tests/disorder_tests.js +++ b/clustertest/disorder/tests/disorder_tests.js @@ -24,6 +24,7 @@ coordinator.includeFile('disorder/tests/CleanupTest.js'); coordinator.includeFile('disorder/tests/RecreateSet.js'); coordinator.includeFile('disorder/tests/MergeSet.js'); coordinator.includeFile('disorder/tests/BulkAddingTest.js'); +coordinator.includeFile('disorder/tests/WaitForTest.js'); var tests = [new EmptySet(coordinator,results) ,new OmitCopy(coordinator,results) @@ -48,13 +49,14 @@ var tests = ,new RenameTests(coordinator,results) ,new MergeSet(coordinator,results) ,new BulkAddingTest(coordinator,results) + ,new WaitForTest(coordinator,results) //Below tests are known to fail. ,new UnsubscribeBeforeEnable(coordinator,results) ,new DropSet(coordinator,results) //fails bug 133 ,new CleanupTest(coordinator,results) //cleanup_interval does not (yet) do what the test wants ]; -//tests=[new BulkAddingTest(coordinator,results)]; +//tests=[new WaitForTest(coordinator,results)]; var basicTest = new BasicTest(coordinator,results); -- 1.7.0.4