Remove multicol tests: already done inside of other tests with bucardo_test2
authorGreg Sabino Mullane <greg@endpoint.com>
Tue, 24 Aug 2010 20:49:01 +0000 (16:49 -0400)
committerGreg Sabino Mullane <greg@endpoint.com>
Tue, 24 Aug 2010 20:49:01 +0000 (16:49 -0400)
MANIFEST
t/06-multicolpk.t [deleted file]
t/06-multicolpushdelta.t [deleted file]
t/07-multicolswap.t [deleted file]
t/BucardoTesting.pm

index e64701cddafbd390aed8ecc982ee867a3dc2bb4e..2b30f9a3a02620fa029c84ef131e0761f5817c8f 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -30,9 +30,6 @@ bucardo_ctl.html
 ## Testing-related stuff
 .perlcriticrc
 t/01-basic.t
-t/06-multicolpk.t
-t/06-multicolpushdelta.t
-t/07-multicolswap.t
 t/08-wildkick.t
 t/09-uniqueconstraint.t
 t/10-fullcopy.t
diff --git a/t/06-multicolpk.t b/t/06-multicolpk.t
deleted file mode 100644 (file)
index 4556b57..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-#!perl
-
-## Test of multi-col PK replication
-
-use 5.008003;
-use strict;
-use warnings;
-use Data::Dumper;
-use lib 't','.';
-use DBD::Pg;
-use Test::More 'no_plan';
-
-use BucardoTesting;
-my $bct = BucardoTesting->new() or BAIL_OUT "Creation of BucardoTesting object failed\n";
-$location = 'fullcopy';
-
-use vars qw/$SQL $sth $t $i $result $count %sql %val %pkey/;
-
-pass("*** Beginning 'fullcopy' tests");
-
-## Prepare a clean Bucardo database on A
-my $dbhA = $bct->blank_database('A');
-my $dbhX = $bct->setup_bucardo(A => $dbhA);
-
-## Server A is the master, the rest are slaves
-my $dbhB = $bct->blank_database('B');
-my $dbhC = $bct->blank_database('C');
-
-$dbhA->do(qq{ALTER TABLE bucardo_test1 DROP CONSTRAINT bucardo_test1_pkey});
-$dbhA->do(qq{ALTER TABLE bucardo_test1 ADD CONSTRAINT bucardo_test1_pkey2 PRIMARY KEY (data1,inty)});
-$dbhA->commit();
-
-$dbhB->do(qq{ALTER TABLE bucardo_test1 DROP CONSTRAINT bucardo_test1_pkey});
-$dbhB->do(qq{ALTER TABLE bucardo_test1 ADD CONSTRAINT bucardo_test1_pkey2 PRIMARY KEY (data1,inty)});
-$dbhB->commit();
-
-## Tell Bucardo about these databases
-$bct->add_test_databases('A B C');
-
-## Create a herd for 'A' and add all test tables to it
-$bct->add_test_tables_to_herd('A', 'testherd1');
-
-## Create a new sync to fullcopy from A to B
-$t=q{Add sync works};
-$i = $bct->ctl("add sync multicoltest source=testherd1 type=pushdelta targetdb=B");
-like($i, qr{Added sync}, $t);
-
-$SQL = "SELECT * FROM sync";
-my $info = $dbhX->selectall_arrayref($SQL);
-$bct->restart_bucardo($dbhX);
-
-$dbhX->do('LISTEN bucardo_syncdone_multicoltest');
-$dbhX->commit();
-
-for my $table (sort keys %tabletype) {
-
-    my $type = $tabletype{$table};
-    my $val = $val{$type}{1};
-    if (!defined $val) {
-        BAIL_OUT "Could not determine value for $table $type\n";
-    }
-
-    $pkey{$table} = $table =~ /test5/ ? q{"id space"} : 'id';
-
-    $SQL = $table =~ /0/
-        ? "INSERT INTO $table($pkey{$table}) VALUES (?)"
-            : "INSERT INTO $table($pkey{$table},data1,inty) VALUES (?,'one',1)";
-    $sql{insert}{$table} = $dbhA->prepare($SQL);
-    if ($type eq 'BYTEA') {
-        $sql{insert}{$table}->bind_param(1, undef, {pg_type => PG_BYTEA});
-    }
-    $val{$table} = $val;
-
-    $sql{insert}{$table}->execute($val{$table});
-
-    last; ## Just the first table for now
-}
-
-$dbhA->commit();
-
-sub test_empty_drop {
-    my ($table, $dbh) = @_;
-    my $DROPSQL = 'SELECT * FROM droptest';
-    my $line = (caller)[2];
-    $t=qq{ Triggers and rules did NOT fire on remote table $table};
-    $result = [];
-    bc_deeply($result, $dbhB, $DROPSQL, $t, $line);
-}
-
-for my $table (sort keys %tabletype) {
-    $t=qq{ Second table $table still empty before commit };
-
-    $SQL = $table =~ /0/
-        ? "SELECT $pkey{$table} FROM $table"
-            : "SELECT $pkey{$table},data1 FROM $table";
-    $result = [];
-    bc_deeply($result, $dbhB, $SQL, $t);
-
-    $t=q{ After insert, trigger and rule both populate droptest table };
-    my $qtable = $dbhX->quote($table);
-    my $LOCALDROPSQL = $table =~ /0/
-        ? "SELECT type,0 FROM droptest WHERE name = $qtable ORDER BY 1,2"
-            : "SELECT type,inty FROM droptest WHERE name = $qtable ORDER BY 1,2";
-    my $tval = $table =~ /0/ ? 0 : 1;
-    $result = [['rule',$tval],['trigger',$tval]];
-    bc_deeply($result, $dbhA, $LOCALDROPSQL, $t);
-
-    test_empty_drop($table,$dbhB);
-    last;
-}
-
-for my $table (sort keys %tabletype) {
-    $t=qq{ Second table $table still empty before kick };
-    $sql{select}{$table} = "SELECT inty FROM $table ORDER BY $pkey{$table}";
-    $table =~ /0/ and $sql{select}{$table} =~ s/inty/$pkey{$table}/;
-    $result = [];
-    bc_deeply($result, $dbhB, $sql{select}{$table}, $t);
-    last;
-}
-
-$bct->ctl("kick multicoltest 0");
-wait_for_notice($dbhX, 'bucardo_syncdone_multicoltest', 5);
-
-for my $table (sort keys %tabletype) {
-    $t=qq{ Second table $table got the row};
-    $result = [[1]];
-    bc_deeply($result, $dbhB, $sql{select}{$table}, $t);
-
-    test_empty_drop($table,$dbhB);
-    last;
-}
-
-END {
-    $bct->stop_bucardo($dbhX);
-    $dbhX->disconnect();
-    $dbhA->disconnect();
-    $dbhB->disconnect();
-    $dbhC->disconnect();
-}
-
diff --git a/t/06-multicolpushdelta.t b/t/06-multicolpushdelta.t
deleted file mode 100644 (file)
index dcc17e2..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#!perl
-
-# Test multi-column primary keys
-
-use 5.008003;
-use strict;
-use warnings;
-use Data::Dumper;
-use lib 't','.';
-use DBD::Pg;
-use Test::More 'no_plan';
-
-no warnings 'redefine';
-use BucardoTesting;
-use warnings;
-
-my $bct = BucardoTesting->new() or BAIL_OUT "Creation of BucardoTesting object failed\n";
-
-pass(q{*** Beginning 'multicol pk' tests});
-
-## Prepare a clean Bucardo database on A
-my $dbhA = $bct->blank_database('A');
-my $dbhX = $bct->setup_bucardo(A => $dbhA);
-
-## Server A is the master, the rest are slaves
-my $dbhB = $bct->blank_database('B');
-
-my $res = $dbhB->selectall_arrayref('SELECT * FROM bucardo_test_multicol');
-is($#$res, -1, 'Slave test table is empty');
-$dbhB->rollback();
-
-## Tell Bucardo about these databases
-$bct->add_test_databases('A B');
-
-## Create a herd for 'A' and add all test tables to it
-$bct->add_test_tables_to_herd('A', 'testherd1');
-
-## Pushdelta sync from A to B
-my $t=q{Add sync works};
-my $i = $bct->ctl("add sync multicolpushdeltatest source=testherd1 type=pushdelta targetdb=B");
-like($i, qr{Added sync}, $t);
-
-$bct->restart_bucardo($dbhX);
-
-# Insert 5 rows and see if they replicate
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 1, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 2, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 3, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 4, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 5, 1, 'test')});
-$dbhA->commit();
-
-$dbhX->do(q{LISTEN bucardo_syncdone_multicolpushdeltatest});
-$dbhX->commit();
-$bct->ctl('kick multicolpushdeltatest 5');
-eval {
-    wait_for_notice($dbhX, 'bucardo_syncdone_multicolpushdeltatest', 5);
-};
-ok(! $@, 'Sync pushed');
-
-$res = $dbhB->selectall_arrayref('SELECT id, id2, id3, data FROM bucardo_test_multicol');
-is($#$res, 4, 'Slave table contains 5 rows');
-$dbhB->rollback();
-
-# Update a row and see if it replicates
-$dbhA->do(q{UPDATE bucardo_test_multicol SET data = 'test2' WHERE id2 = 2});
-$dbhA->commit();
-
-$bct->ctl('kick multicolpushdeltatest 5');
-eval {
-    wait_for_notice($dbhX, 'bucardo_syncdone_multicolpushdeltatest', 5);
-};
-ok(! $@, 'Sync pushed');
-$res = $dbhB->selectall_arrayref(q{SELECT * FROM bucardo_test_multicol WHERE id2 = 2 AND data = 'test'});
-is($#$res, -1, 'Row successfully updated');
-$dbhB->rollback();
-
-# Remove a row and see if it replicates
-$dbhA->do(q{DELETE FROM bucardo_test_multicol WHERE id2 = 1});
-$dbhA->commit();
-
-$bct->ctl('kick multicolpushdeltatest 5');
-eval {
-    wait_for_notice($dbhX, 'bucardo_syncdone_multicolpushdeltatest', 5);
-};
-ok(! $@, 'Sync pushed');
-$res = $dbhB->selectall_arrayref('SELECT * FROM bucardo_test_multicol WHERE id2 = 1');
-is($#$res, -1, 'Row successfully deleted');
-$dbhB->rollback();
-
-END {
-    $bct->stop_bucardo($dbhX);
-    $dbhX->disconnect();
-    $dbhA->disconnect();
-    $dbhB->disconnect();
-}
diff --git a/t/07-multicolswap.t b/t/07-multicolswap.t
deleted file mode 100644 (file)
index 9119018..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#!perl
-
-# Test multi-column primary keys
-
-use 5.008003;
-use strict;
-use warnings;
-use Data::Dumper;
-use lib 't','.';
-use DBD::Pg;
-use Test::More 'no_plan';
-
-no warnings 'redefine';
-use BucardoTesting;
-use warnings;
-
-my $bct = BucardoTesting->new() or BAIL_OUT "Creation of BucardoTesting object failed\n";
-
-pass(q{*** Beginning 'multicol pk' tests});
-
-## Prepare a clean Bucardo database on A
-my $dbhA = $bct->blank_database('A');
-my $dbhX = $bct->setup_bucardo(A => $dbhA);
-
-## Server A is the master, the rest are slaves
-my $dbhB = $bct->blank_database('B');
-
-my $res = $dbhA->selectall_arrayref('SELECT * FROM bucardo_test_multicol');
-is($#$res, -1, 'Test table in database A is empty');
-$dbhA->rollback();
-
-$res = $dbhB->selectall_arrayref('SELECT * FROM bucardo_test_multicol');
-is($#$res, -1, 'Test table in database B is empty');
-$dbhB->rollback();
-
-## Tell Bucardo about these databases
-$bct->add_test_databases('A B');
-
-## Create a herd for 'A' and add all test tables to it
-$bct->add_test_tables_to_herd('A', 'testherd1');
-
-# Setting up conflict resolution methods
-$dbhX->do(q{UPDATE bucardo.goat SET standard_conflict = 'source'});
-$dbhX->commit();
-
-## Pushdelta sync from A to B
-my $t=q{Add sync works};
-print "Adding sync\n";
-my $i = $bct->ctl("add sync multicolswaptest source=testherd1 type=swap targetdb=B");
-print "Added sync: $i\n";
-like($i, qr{Added sync}, $t);
-
-$bct->restart_bucardo($dbhX);
-
-# Insert 5 rows and see if they replicate
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 1, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 2, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 3, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 4, 1, 'test')});
-$dbhA->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (1, 5, 1, 'test')});
-$dbhA->commit();
-
-$dbhB->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (4, 1, 1, 'test')});
-$dbhB->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (4, 2, 1, 'test')});
-$dbhB->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (4, 3, 1, 'test')});
-$dbhB->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (4, 4, 1, 'test')});
-$dbhB->do(q{INSERT INTO bucardo_test_multicol (id, id2, id3, data) VALUES (4, 5, 1, 'test')});
-$dbhB->commit();
-
-$dbhX->do(q{LISTEN bucardo_syncdone_multicolswaptest});
-$dbhX->commit();
-$bct->ctl('kick multicolswaptest 5');
-eval {
-    wait_for_notice($dbhX, 'bucardo_syncdone_multicolswaptest', 5);
-};
-ok(! $@, 'Sync pushed');
-
-$res = $dbhA->selectall_arrayref('SELECT id, id2, id3, data FROM bucardo_test_multicol');
-is($#$res, 9, 'Test table in A contains 9 rows');
-$dbhA->rollback();
-
-$res = $dbhB->selectall_arrayref('SELECT id, id2, id3, data FROM bucardo_test_multicol');
-is($#$res, 9, 'Test table in B contains 9 rows');
-$dbhB->rollback();
-
-# Update a row and see if it replicates
-$dbhA->do(q{UPDATE bucardo_test_multicol SET data = 'test2' WHERE id2 = 2});
-$dbhA->commit();
-
-$bct->ctl('kick multicolswaptest 5');
-eval {
-    wait_for_notice($dbhX, 'bucardo_syncdone_multicolswaptest', 5);
-};
-ok(! $@, 'Sync pushed');
-$res = $dbhB->selectall_arrayref(q{SELECT * FROM bucardo_test_multicol WHERE id = 1 AND id2 = 2 AND data = 'test'});
-is($#$res, -1, 'Row successfully updated');
-$dbhB->rollback();
-
-# Remove a row and see if it replicates
-$dbhB->do(q{DELETE FROM bucardo_test_multicol WHERE id = 1 AND id2 = 1});
-$dbhB->commit();
-
-$bct->ctl('kick multicolswaptest 5');
-eval {
-    wait_for_notice($dbhX, 'bucardo_syncdone_multicolswaptest', 5);
-};
-ok(! $@, 'Sync pushed');
-$res = $dbhA->selectall_arrayref('SELECT * FROM bucardo_test_multicol WHERE id = 1 AND id2 = 1');
-is($#$res, -1, 'Row successfully deleted');
-print Dumper($res);
-$dbhA->rollback();
-
-END {
-    $bct->stop_bucardo($dbhX);
-    $dbhX->disconnect();
-    $dbhA->disconnect();
-    $dbhB->disconnect();
-}
index 105a13b3f3bb2e6c43a473b85aebb195311e1813..8c039030aaef2b3bfed5ee78d3119a669f723603 100644 (file)
@@ -56,7 +56,7 @@ our %tabletype =
      'bucardo_test9' => 'int_unsigned',
      );
 
-our @tables2empty = (qw/droptest bucardo_test_multicol/);
+our @tables2empty = (qw/droptest/);
 
 our %sequences =
     (
@@ -670,16 +670,6 @@ sub add_test_schema {
         $dbh->do($SQL);
     }
 
-    if ( !table_exists($dbh => 'bucardo_test_multicol') ) {
-        $tcount++;
-        $dbh->do(q{CREATE TABLE bucardo_test_multicol (
-        id   INTEGER,
-        id2  INTEGER,
-        id3  INTEGER,
-        data TEXT,
-        PRIMARY KEY (id, id2, id3))});
-    }
-
     ## Create one sequence for each table type
     for my $seq (sort keys %sequences) {
 
@@ -1376,7 +1366,6 @@ sub add_test_tables_to_herd {
     }
 
     my $addstring = join ' ' => sort keys %tabletype;
-    $addstring .= ' bucardo_test_multicol';
     my $com = "add table $addstring db=$db herd=$herd";
     $result = $self->ctl($com);
     if ($result !~ /Added table/) {