add a regression test for EXECUTE SCRIPT using a non-provider event node
authorSteve Singer <ssinger@ca.afilias.info>
Mon, 28 Oct 2013 18:11:10 +0000 (14:11 -0400)
committerSteve Singer <ssinger@ca.afilias.info>
Sat, 2 Nov 2013 18:58:54 +0000 (14:58 -0400)
clustertest/regression/testddl/testddl.js

index 7ecf4755c137fb790a146281c80652fea7a85937..5bacb95d44fbb3aa8e0c5efe00a306850971a51d 100644 (file)
@@ -164,6 +164,34 @@ function inline_ddl(coordinator) {
 }
 
 
+function execute_on_subscriber(coordinator)
+{
+    /**
+     * Perform an EXECUTE SCRIPT with a subscriber (a non-provider)
+     * and verify that the DDL changes replicate to all other nodes.
+     */
+    var premable = get_slonik_preamble();
+    var slonikScript = 'EXECUTE SCRIPT('
+       + 'SQL=\'CREATE TABLE test_on_subscriber(id serial, value text);\''
+       + ' ,EVENT NODE=3);\n'
+        + 'sync(id=3);\n wait for event(origin=3, confirmed=all, wait on=3);\n';
+    
+    run_slonik('execute_on_subscriber.create',coordinator,preamble,slonikScript);
+    /**
+     * Now drop the table on nodes 1 and 2. 
+     * That will fail if the CREATE did not propogate
+     */
+    slonikScript = 'EXECUTE SCRIPT('
+       + 'SQL=\'DROP TABLE test_on_subscriber;\''
+       + ' ,EVENT NODE=2, EXECUTE ONLY ON=2);\n' 
+       + 'EXECUTE SCRIPT('
+       + 'SQL=\'DROP TABLE test_on_subscriber;\''
+       + ' ,EVENT NODE=1, EXECUTE ONLY ON=1);\n' 
+            
+    run_slonik('execute_on_subscriber.drop',coordinator,preamble,slonikScript);
+    
+}
+
 function do_test(coordinator) {
 
        var numrows = random_number(150,350);
@@ -200,7 +228,7 @@ function do_test(coordinator) {
 
        trigger_function(coordinator);
        wait_for_sync(coordinator);
-
+       execute_on_subscriber(coordinator);
 }
 
 function get_compare_queries() {
@@ -211,4 +239,5 @@ function get_compare_queries() {
        return queries;
 }
 
+
 run_test(coordinator,'testddl');