diff options
author | Greg Sabino Mullane | 2010-05-20 15:47:41 +0000 |
---|---|---|
committer | Greg Sabino Mullane | 2010-05-20 15:47:41 +0000 |
commit | 0d4a33ce56950d0fb8f53ce273c208dbf0daca9f (patch) | |
tree | 84e9b8bf6efef4591f555cba744065d1fe9664b6 | |
parent | a82f282972895e7b5fa80896d846fae4d360aa52 (diff) |
Add tests for new same_schema index items.
-rw-r--r-- | t/02_same_schema.t | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/t/02_same_schema.t b/t/02_same_schema.t index f7d566002..1623df170 100644 --- a/t/02_same_schema.t +++ b/t/02_same_schema.t @@ -6,7 +6,7 @@ use 5.006; use strict; use warnings; use Data::Dumper; -use Test::More tests => 47; +use Test::More tests => 50; use lib 't','.'; use CP_Testing; @@ -374,21 +374,48 @@ like ($cp1->run($stdargs), $t); $t = qq{$S fails when database 1 has a language that 2 does not}; -$dbh1->do('create language plpgsql'); +$dbh1->do('CREATE LANGUAGE plpgsql'); like ($cp1->run($stdargs), qr{^$label CRITICAL:.*Items not matched: 1 .*Language on 1 but not 2: plpgsql}, $t); $t = qq{$S works when languages are the same}; -$dbh2->do('create language plpgsql'); +$dbh2->do('CREATE LANGUAGE plpgsql'); like ($cp1->run($stdargs), qr{^$label OK:}, $t); $t = qq{$S fails when database 2 has a language that 1 does not}; -$dbh1->do('drop language plpgsql'); +$dbh1->do('DROP LANGUAGE plpgsql'); like ($cp1->run($stdargs), qr{^$label CRITICAL:.*Items not matched: 1 .*Language on 2 but not 1: plpgsql}, $t); +$dbh2->do('DROP LANGUAGE plpgsql'); + +#/////////// Indexes + +$dbh1->do(q{CREATE TABLE table_1_only (a int, b text)}); +$dbh2->do(q{CREATE TABLE table_1_only (a int, b text)}); + +$t = qq{$S works when indexes are the same}; +$dbh1->do(q{CREATE INDEX index_1 ON table_1_only(a)}); +$dbh2->do(q{CREATE INDEX index_1 ON table_1_only(a)}); +like ($cp1->run($stdargs), + qr{^$label OK:}, + $t); + +$t = qq{$S fails when database 1 has an index that 2 does not}; +$dbh1->do(q{CREATE INDEX index_2 ON table_1_only(a,b)}); +like ($cp1->run($stdargs), + qr{^$label CRITICAL:.*Index on 1 but not 2: public.index_2}, + $t); + +$t = qq{$S fails when database 2 has an index that 1 does not}; +$dbh1->do(q{DROP INDEX index_2}); +$dbh2->do(q{CREATE INDEX index_3 ON table_1_only(a,b)}); +like ($cp1->run($stdargs), + qr{^$label CRITICAL:.*Index on 2 but not 1: public.index_3}, + $t); + exit; |