Testing tweaks.
authorGreg Sabino Mullane <greg@endpoint.com>
Thu, 23 Feb 2012 21:32:57 +0000 (16:32 -0500)
committerGreg Sabino Mullane <greg@endpoint.com>
Thu, 23 Feb 2012 21:32:57 +0000 (16:32 -0500)
TODO
t/02-bctl-db.t
t/10-fullcopy.t
t/BucardoTesting.pm

diff --git a/TODO b/TODO
index 7851e343717369a5221fff52000af3428296f6e3..c49bf8cf7a7ee58ff30a5960f8d423aef4840dea 100644 (file)
--- a/TODO
+++ b/TODO
@@ -5,7 +5,6 @@ Version 5:
 
 * Fix quoting bug reported by Sean M. Pappalardo
 * Fix need for password argument when using md5
-* Get pkonly working with 'bucardo add all tables'
 * Get Drizzle tests verified as working
 * Get bucardo-report working again
 * Note 8.2 minimum requirement somewhere (probably from COPY (select))
index 5dfa67ba70ee182692a0ca3a21ce1d19be1a62ac..b312219f2274eb458a4188dbc5bd5fa98f2e48c0 100644 (file)
@@ -46,19 +46,19 @@ like ($res, qr/must supply a database name/, $t);
 
 $t = q{Add database fails for an invalid port};
 $res = $bct->ctl('bucardo add database foo dbname=bar dbport=1');
-like ($res, qr/Connection test failed.*could not connect to server/s, $t);
+like ($res, qr/Connection .+ failed.*could not connect to server/s, $t);
 
 $t = q{Add database fails for non-existent host};
 $res = $bct->ctl("bucardo add database bucardo_test dbname=bucardo_test user=$dbuserA port=$dbportA host=badbucardohost");
-like ($res, qr/Connection test failed.*could not translate host name/s, $t);
+like ($res, qr/Connection .+ failed.*could not translate host name/s, $t);
 
 $t = q{Add database fails for non-existent database};
 $res = $bct->ctl("bucardo add database foo dbname=bar user=$dbuserA port=$dbportA host=$dbhostA");
-like ($res, qr/Connection test failed.*database "bar" does not exist/s, $t);
+like ($res, qr/Connection .+ failed.*database "bar" does not exist/s, $t);
 
 $t = q{Add database fails for non-existent user};
 $res = $bct->ctl("bucardo add database bucardo_test dbname=bucardo_test user=nobob port=$dbportA host=$dbhostA");
-like ($res, qr/Connection test failed.* "nobob" does not exist/s, $t);
+like ($res, qr/Connection .+ failed.* "nobob" does not exist/s, $t);
 
 $t = q{Add database works for non-existent cluster with --force flag};
 $res = $bct->ctl('bucardo add database foo dbname=bar --force');
index 76de4ed83a8d6c0876eb043729588d1d8edf28ec..dde8f938a681301a8f321be833603f50f6527e28 100644 (file)
@@ -15,7 +15,6 @@ use BucardoTesting;
 my $bct = BucardoTesting->new() or BAIL_OUT "Creation of BucardoTesting object failed\n";
 $location = 'fullcopy';
 
-my $numtabletypes = keys %tabletype;
 plan tests => 339;
 
 pass("*** Beginning 'fullcopy' tests");
@@ -42,8 +41,6 @@ $dbhD = $bct->repopulate_cluster('D');
 ## Create a bucardo database, and install Bucardo into it
 $dbhX = $bct->setup_bucardo('A');
 
-## Tell Bucardo about these databases
-
 ## Teach Bucardo about four databases
 for my $name (qw/ A B C D /) {
     $t = "Adding database from cluster $name works";
@@ -53,12 +50,12 @@ for my $name (qw/ A B C D /) {
     like ($res, qr/Added database "$name"/, $t);
 }
 
-## Put all primary key tables into a herd
+## Put all tables (including non-PK) into a herd
 $t = q{Adding all PK tables on the master works};
 $command =
-"bucardo add tables all db=A herd=pk pkonly";
+"bucardo add tables '*bucardo_test*' db=A herd=all";
 $res = $bct->ctl($command);
-like ($res, qr/Creating herd: pk.*New tables added: \d/s, $t);
+like ($res, qr/Created the herd named "all".*are now part of/s, $t);
 
 ## Create a new database group going from A and B to C and D
 $t = q{Created a new database group};
@@ -70,15 +67,16 @@ like ($res, qr/Created database group "pg"/, $t);
 ## Create a new sync
 $t = q{Created a new sync};
 $command =
-"bucardo add sync fctest herd=pk dbs=pg ping=false";
+"bucardo add sync fctest herd=all dbs=pg type=fullcopy";
 $res = $bct->ctl($command);
 like ($res, qr/Added sync "fctest"/, $t);
 
-## Start up Bucardo with this new sync
+## Start up Bucardo with this new sync.
+## No need to wait for the sync, as fullcopy syncs don't auto-run
 $bct->restart_bucardo($dbhX);
-## Immediate kicks to catch any startup sync effects
-$bct->ctl('bucardo kick fctest 0');
-$bct->ctl('bucardo kick fctest 0');
+
+
+
 
 ## Get the statement handles ready for each table type
 for my $table (sort keys %tabletype) {
@@ -351,7 +349,7 @@ like ($res, qr/Created database group "pg2"/, $t);
 ## Create a new sync
 $t = q{Created a new sync};
 $command =
-"bucardo add sync fctest2 herd=pk dbs=pg2 ping=false";
+"bucardo add sync fctest2 herd=all dbs=pg2 ping=false";
 $res = $bct->ctl($command);
 like ($res, qr/Added sync "fctest2"/, $t);
 
@@ -419,7 +417,7 @@ like ($res, qr/Created database group "pg3"/, $t);
 ## Create a new sync
 $t = q{Created a new sync};
 $command =
-"bucardo add sync fctest3 herd=pk dbs=pg3 ping=false";
+"bucardo add sync fctest3 herd=all dbs=pg3 ping=false";
 $res = $bct->ctl($command);
 like ($res, qr/Added sync "fctest3"/, $t);
 
index 99910aa65a34eae74d74f8d07659c6463da9827e..3e036eb33a60203c1acb32d3261db8711a448388 100644 (file)
@@ -909,7 +909,7 @@ sub ctl {
 sub restart_bucardo {
 
     ## Start Bucardo, but stop first if it is already running
-    ## Arguments:
+    ## Arguments: one, two, or three
     ## 1. database handle to the bucardo_control_test db
     ## 2. The notice we wait for, defaults to: bucardo_started
     ## 3. The message to give to the "pass" function, defaults to: Bucardo was started
@@ -1020,7 +1020,7 @@ sub setup_bucardo {
     $dbh = $self->connect_database($clustername, 'bucardo');
 
     ## Make some adjustments
-    $sth = $dbh->prepare('UPDATE bucardo.bucardo_config SET value = $2 WHERE setting = $1');
+    $sth = $dbh->prepare('UPDATE bucardo.bucardo_config SET setting = $2 WHERE name = $1');
     $count = $sth->execute('piddir' => $PIDDIR);
     $count = $sth->execute('reason_file' => "$PIDDIR/reason");
     $count = $sth->execute('sendmail_file' => 'debug.sendmail.txt');
@@ -1399,7 +1399,7 @@ sub add_bucardo_schema_to_database {
     $dbh->commit();
 
     ## Make some adjustments
-    $sth = $dbh->prepare('UPDATE bucardo.bucardo_config SET value = $2 WHERE setting = $1');
+    $sth = $dbh->prepare('UPDATE bucardo.bucardo_config SET setting = $2 WHERE name = $1');
     $count = $sth->execute('piddir' => $PIDDIR);
     $count = $sth->execute('reason_file' => "$PIDDIR/reason");
     $count = $sth->execute('audit_pid' => 1);