Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding some more tests.

Check the behaviour of bulk add if a admin conninfo node can't
be reached or does not have slony installed.
  • Loading branch information...
commit 0eacde80ed947b199169534849b18cf8301e5245 1 parent 52e3155
@ssinger ssinger authored
Showing with 60 additions and 0 deletions.
  1. +60 −0 clustertest/disorder/tests/BulkAddingTest.js
View
60 clustertest/disorder/tests/BulkAddingTest.js
@@ -102,12 +102,72 @@ BulkAddingTest.prototype.runTest = function() {
this.slonikSync(1, 1);
this.compareDb('db1','db2');
this.compareDb('db1','db3');
+ slonikScript="drop set(id=1,origin=1);";
+ slonik = this.coordinator.createSlonik('drop set 1',slonikPreamble,slonikScript);
+ slonik.run();
+ this.coordinator.join(slonik);
+ this.testResults.assertCheck('drop set okay',slonik.getReturnCode(),0);
+
for(var idx=1; idx <= this.getNodeCount(); idx++) {
slonArray[idx-1].stop();
this.coordinator.join(slonArray[idx-1]);
}
+
+ /**
+ * try a slonik script with an admin conninfo node
+ * to a database that does not exist.
+ *
+ * since slonik uses libpq we can declare a
+ * unix socket style hostname to something
+ * that is unlikely to exist.
+ */
+ slonikPreamble = this.getSlonikPreamble();
+ slonikPreamble += "node 99 admin conninfo='dbname=none host=/tmp/no_socket';\n"
+ slonikScript="create set(id=4, origin=1);\n" +
+ "set add table(set id=4, fully qualified name='disorder.do_config');\n";
+ slonik=this.coordinator.createSlonik('add table - bad admin node',
+ slonikPreamble,slonikScript);
+ slonik.run();
+ this.coordinator.join(slonik);
+ this.testResults.assertCheck('slonik detected a non-existant conninfo',
+ slonik.getReturnCode()!=0,true);
+
+
+ /**
+ * try it with a conninfo that points to a database that does not
+ * have slony installed - yet.
+ */
+ this.createDb(['db6']);
+ this.getNodeCount=function() {
+ return 6;
+ }
+ slonikPreamble=this.getSlonikPreamble();
+ slonikScript="set add table(set id=4, fully qualified name='disorder.do_config');\n";
+ slonik=this.coordinator.createSlonik('add table - node with slony not installed',slonikPreamble,slonikScript);
+ slonik.run();
+ this.coordinator.join(slonik);
+ this.testResults.assertCheck('add table worked - conninfo for a node without slony',slonik.getReturnCode(),0);
+
+ /**
+ * try adding the table again via the bulk command.
+ * this should fail.
+ */
+ slonikScript="set add table(set id=4, tables='disorder.do_config*');\n";
+ slonik=this.coordinator.createSlonik('add table - duplicate',
+ slonikPreamble,slonikScript);
+ slonik.run();
+ this.coordinator.join(slonik);
+ this.testResults.assertCheck('add table duplicate failed',
+ slonik.getReturnCode()!=0,true);
+
+ this.dropDb(['db6']);
+
+
}
+
+
+
BulkAddingTest.prototype.validateNode1=function()
{
var connection = this.coordinator.createJdbcConnection('db1');
Please sign in to comment.
Something went wrong with that request. Please try again.