Skip to content

Commit

Permalink
test(perl-libs): check if env file exist before moving it
Browse files Browse the repository at this point in the history
Refs:MON-106121
  • Loading branch information
Evan-Adam committed Nov 19, 2024
1 parent a105b22 commit ed6e837
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions perl-libs/lib/t/common/centreonvault.t
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ sub test_transform_json_to_object {
}
sub test_get_app_secret {
`mkdir -p /usr/share/centreon/`;
`mv /usr/share/centreon/.env /usr/share/centreon/.env.back`;
-e '/usr/share/centreon/.env' and `mv /usr/share/centreon/.env /usr/share/centreon/.env.back`;

my $old_app_secret = $ENV{'APP_SECRET'};
my $res = "SECRET";
$ENV{'APP_SECRET'} = $res;
Expand All @@ -161,7 +162,7 @@ sub test_get_app_secret {
close($fh);
is(centreon::common::centreonvault->get_app_secret(), $res, "get_app_secret() should get value from file.");
`rm /usr/share/centreon/.env`;
`mv /usr/share/centreon/.env.back /usr/share/centreon/.env`;
-e '/usr/share/centreon/.env.back' and `mv /usr/share/centreon/.env.back /usr/share/centreon/.env`;
$ENV{'APP_SECRET'} = $old_app_secret;
}

Expand Down

0 comments on commit ed6e837

Please sign in to comment.