Skip to content

Commit

Permalink
Merge pull request #558 from cpanel/RE-974
Browse files Browse the repository at this point in the history
Only perform mysql database is corrupted check in start mode
  • Loading branch information
cPholloway authored Nov 25, 2024
2 parents 27de904 + dfed53c commit 7c3dfe2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -4020,6 +4020,8 @@ EOS

sub _blocker_mysql_database_corrupted ($self) {

return 0 if $self->is_check_mode();

return 0 unless Cpanel::MysqlUtils::MyCnf::Basic::is_local_mysql();

if ( !Cpanel::MysqlUtils::Running::is_mysql_running() ) {
Expand Down
2 changes: 2 additions & 0 deletions lib/Elevate/Components/MySQL.pm
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ sub _blocker_mysql_upgrade_in_progress ($self) {

sub _blocker_mysql_database_corrupted ($self) {

return 0 if $self->is_check_mode();

# Do not perform this check for remote mysql
return 0 unless Cpanel::MysqlUtils::MyCnf::Basic::is_local_mysql();

Expand Down
11 changes: 11 additions & 0 deletions t/components-MySQL.t
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,17 @@ EOS
$restart_mysql = 0;
@ssystem_output = ();

my $mock_elevate_comp = Test::MockModule->new('Elevate::Components');
$mock_elevate_comp->redefine(
is_check_mode => 1,
);

is( $db->_blocker_mysql_database_corrupted(), 0, 'The check is a noop in check mode' );

$mock_elevate_comp->redefine(
is_check_mode => 0,
);

like(
$db->_blocker_mysql_database_corrupted(),
{
Expand Down

0 comments on commit 7c3dfe2

Please sign in to comment.