Skip to content

Commit

Permalink
Test when _unique_error returns false
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Jul 30, 2023
1 parent 178d8e0 commit 26ff978
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/exasol.t
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ DBI: {
$DBI::errstr = 'object foo not found';
ok $exa->_no_table_error, 'Should now have table error';
ok $exa->_no_column_error, 'Should now have no column error';
ok !$exa->_unique_error, 'Unique constraints not supported by Exasol';
}

is_deeply [$exa->_limit_offset(8, 4)],
Expand Down
10 changes: 10 additions & 0 deletions t/lib/DBIEngineTest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,16 @@ sub run {
'Cannot log change "{change}": The deploy script is not unique',
change => $name,
), 'And it should report the script is not unique';

# Make sure log_deploy_change dies on any other error.
MOCKPROJECT: {
my $engine_mocker = Test::MockModule->new(ref $engine);
$engine_mocker->mock(_unique_error => 0);
throws_ok { $engine->log_deploy_change($rev_change) } 'App::Sqitch::X',
'Should re-throw if not a unique erorr';
is $@->ident, $DBI::state, 'Mode should be the error state';
is $@->message, $DBI::errstr, 'Should not have the underlying DB error';
}
}

# Make a temporary copy of the deploy file so we can restore it later.
Expand Down
1 change: 1 addition & 0 deletions t/snowflake.t
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ DBI: {
$DBI::state = '42703';
ok !$snow->_no_table_error, 'Should again have no table error';
ok $snow->_no_column_error, 'Should now have no column error';
ok !$snow->_unique_error, 'Unique constraints not supported by Snowflake';
}

is_deeply [$snow->_limit_offset(8, 4)],
Expand Down

0 comments on commit 26ff978

Please sign in to comment.