Skip to content

Commit

Permalink
transactional: Add function install_internal_certificate
Browse files Browse the repository at this point in the history
Installation of internal certificates will be done in multiple
places. Let's create function for it.
  • Loading branch information
czerw committed Oct 8, 2024
1 parent 77ab2fd commit 19df79f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 15 additions & 0 deletions lib/transactional.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ our @EXPORT = qw(
exit_trup_shell_and_reboot
reboot_on_changes
record_kernel_audit_messages
install_internal_certificate
);

# Download files needed for transactional update tests
Expand Down Expand Up @@ -378,6 +379,20 @@ sub reboot_on_changes {
else {
record_info("No reboot needed", "Reboot saved because there are no changes happened and no new snapshot generated");
}

=head2 install_internal_certificate
install_internal_certificate
Install SUSE cerificate for internal repositories.
=cut

sub install_internal_certificate {
script_retry('curl -k https://ca.suse.de/certificates/ca/SUSE_Trust_Root.crt -o /etc/pki/trust/anchors/SUSE_Trust_Root.crt', timeout => 100, delay => 30, retry => 5);
script_retry('pgrep update-ca-certificates', retry => 5, delay => 2, die => 0);
assert_script_run 'update-ca-certificates -v';
}
}

1;
4 changes: 1 addition & 3 deletions tests/transactional/install_updates.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ sub run {
select_serial_terminal;

if (is_sle_micro) {
script_retry('curl -k https://ca.suse.de/certificates/ca/SUSE_Trust_Root.crt -o /etc/pki/trust/anchors/SUSE_Trust_Root.crt', timeout => 100, delay => 30, retry => 5);
script_retry('pgrep update-ca-certificates', retry => 5, delay => 2, die => 0);
assert_script_run 'update-ca-certificates -v';
install_internal_certificate;

# Clean the journal to avoid capturing bugs that are fixed after installing updates
assert_script_run('journalctl --no-pager -o short-precise | tail -n +2 > /tmp/journal_before');
Expand Down

0 comments on commit 19df79f

Please sign in to comment.