$location = 'swap';
my $numtabletypes = keys %tabletype;
-plan tests => 11 + ($numtabletypes * 24);
+my $numsequences = keys %sequences;
+plan tests => 12 + ($numtabletypes * 24) + ($numsequences + 1);
pass("*** Beginning swap tests");
## Kick the sync and wait for it to finish
$bct->ctl('kick sync swaptest 0');
+for my $seq (sort keys %sequences) {
+
+ $t = qq{Sequence $seq is copied to database B};
+
+ $SQL = "SELECT sequence_name, last_value, increment_by, max_value, min_value, is_cycled FROM $seq";
+ my $seqA = $dbhA->selectall_arrayref($SQL)->[0];
+ my $seqB = $dbhB->selectall_arrayref($SQL)->[0];
+ is_deeply($seqA, $seqB, $t);
+
+}
+
## Rows should be gone from B now
for my $table (sort keys %tabletype) {
}
## Insert same rows to A and B, change B, extra rows to B
+## Also tweak some sequences
for my $table (sort keys %tabletype) {
my $type = $tabletype{$table};
$dbhA->do($SQL);
$SQL = "UPDATE $table SET inty = 777 WHERE inty <> 66";
$dbhB->do($SQL);
+
+ ## Change a sequence on A
+ $SQL = q{SELECT setval('bucardo_test_seq1', 45)};
+ $dbhA->do($SQL);
+ $SQL = q{ALTER SEQUENCE bucardo_test_seq1 MAXVALUE 400};
+ $dbhA->do($SQL);
+
}
$dbhA->commit();
$dbhB->commit();
bc_deeply($res, $dbhA, $sql{select}{$table}, $t);
$res = [[55],[66],[77]];
bc_deeply($res, $dbhB, $sql{select}{$table}, $t);
+
}
+$t = qq{Sequence bucardo_test_seq1 is copied to database B};
+
+$SQL = 'SELECT sequence_name, last_value, increment_by, max_value, min_value, is_cycled FROM bucardo_test_seq1';
+my $seqA = $dbhA->selectall_arrayref($SQL)->[0];
+my $seqB = $dbhB->selectall_arrayref($SQL)->[0];
+is_deeply($seqA, $seqB, $t);
+
## Make B the "master"
$command =
"bucardo_ctl update all tables standard_conflict=target";
bc_deeply($res, $dbhB, $sql{select}{$table}, $t);
}
+pass('Done with swap testing');
+
exit;