Skip to content

Commit 558651c

Browse files
committed
Test that templates exist; add Cockroach templates
Add a method to DBIEngineTest that verifies that the templates exist for an engine key and put it to use in all of the engine tests. Add the missing CockroachDB templates. Resolves #878.
1 parent eaa1a16 commit 558651c

File tree

14 files changed

+57
-0
lines changed

14 files changed

+57
-0
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Revision history for Perl extension App::Sqitch
99
user may not have such permission, and instead attempts to create the
1010
function and ignores a failure due to a lack of permission. Thanks to
1111
Alastair Douglas for the report and solution (#874)!
12+
- Added missing CockroachDB templates. Thanks to @Peterbyte for the
13+
report (#878)!
1214

1315
1.5.1 2025-03-16T26:55:17Z
1416
- Fixed a bug introduced in v1.5.0 where the MySQL engine connected to
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Deploy [% project %]:[% change %] to [% engine %]
2+
[% FOREACH item IN requires -%]
3+
-- requires: [% item %]
4+
[% END -%]
5+
[% FOREACH item IN conflicts -%]
6+
-- conflicts: [% item %]
7+
[% END -%]
8+
9+
-- XXX Add DDLs here.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Revert [% project %]:[% change %] from [% engine %]
2+
3+
-- XXX Add DDLs here.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Verify [% project %]:[% change %] on [% engine %]
2+
3+
-- XXX Add verifications here.

t/cockroach.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ RUNREG: {
109109
'The registry should have been added to the search path';
110110
}
111111

112+
# Make sure we have templates.
113+
DBIEngineTest->test_templates_for($cockroach->key);
114+
112115
##############################################################################
113116
# Can we do live tests?
114117
$config->replace('core.engine' => 'cockroach');

t/exasol.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ is_deeply [$exa->_regex_expr('corn', 'Obama')],
394394
['corn REGEXP_LIKE ?', '.*Obama.*'],
395395
'Should append wildcards to both ends without anchors';
396396

397+
# Make sure we have templates.
398+
DBIEngineTest->test_templates_for($exa->key);
399+
397400
##############################################################################
398401
# Can we do live tests?
399402
my $dbh;

t/firebird.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ FSPEC: {
391391
), 'Client exception message should be correct';
392392
}
393393

394+
# Make sure we have templates.
395+
DBIEngineTest->test_templates_for($fb->key);
396+
394397
##############################################################################
395398
# Can we do live tests?
396399
my ($data_dir, $fb_version, @cleanup) = ($tmpdir);

t/lib/DBIEngineTest.pm

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use utf8;
66
use Try::Tiny;
77
use Test::More;
88
use Test::Exception;
9+
use Test::File qw(file_exists_ok);
910
use Time::HiRes qw(sleep tv_interval gettimeofday);
1011
use Path::Class 0.33 qw(file dir);
1112
use Digest::SHA qw(sha1_hex);
@@ -35,6 +36,7 @@ sub run {
3536
chomp => 1,
3637
iomode => '<:raw'
3738
);
39+
3840
# Each change should retain its own hash.
3941
my $orig_deploy_hash;
4042
$mock_change->mock(_deploy_hash => sub {
@@ -1913,4 +1915,15 @@ sub get_dependencies {
19131915
}, undef, shift);
19141916
}
19151917

1918+
sub test_templates_for {
1919+
my $key = $_[1];
1920+
# Make sure we have templates.
1921+
for my $action (qw(deploy revert verify)) {
1922+
my $fn = file(__FILE__)->dir->parent->parent->file(
1923+
qw(etc templates), $action, "$key.tmpl",
1924+
);
1925+
file_exists_ok($fn, "etc/templates/$action/$key.tml should exist");
1926+
}
1927+
}
1928+
19161929
1;

t/mysql.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,9 @@ CHECKIT: {
622622
$mock_sqitch->unmock_all;
623623
}
624624

625+
# Make sure we have templates.
626+
DBIEngineTest->test_templates_for($mysql->key);
627+
625628
##############################################################################
626629
# Can we do live tests?
627630
my $dbh;

t/oracle.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,9 @@ is $change_id_in->(1042), join(
623623
'change_id IN (' . join(', ' => ('?') x 42) . ')'
624624
), 'Should get 4 x 250 and 42 groups for 1042 IDs';
625625

626+
# Make sure we have templates.
627+
DBIEngineTest->test_templates_for($ora->key);
628+
626629
##############################################################################
627630
# Can we do live tests?
628631
if (App::Sqitch::ISWIN && eval { require Win32::API }) {

0 commit comments

Comments
 (0)