Skip to content

Commit

Permalink
coverage for bz2221621
Browse files Browse the repository at this point in the history
  • Loading branch information
rmynar committed Jan 11, 2024
1 parent 14cdcc2 commit 838d133
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/foreman/destructive/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,43 @@ def test_positive_installer_certs_regenerate(target_sat):
)
assert result.status == 0
assert 'FAIL' not in target_sat.cli.Base.ping()


def test_handle_invalid_certificate(cert_setup_destructive_teardown):
"""Satellite installer should not do any harmful changes to existing satellite after attempt
to use invalid certificates.
:id: 97b72faf-4684-4d8c-ae0e-1ebd5085620b
:steps:
1. Launch satellite installer and attempt to use invalid certificates
:expectedresults: Satellite installer should fail and Satellite should be running
:BZ: 2221621, 2238363
:customerscenario: true
"""
cert_data, satellite = cert_setup_destructive_teardown

# check if satellite is running
result = satellite.execute('hammer ping')
assert result.status == 0, f'Hammer Ping failed:\n{result.stderr}'

# attempt to use invalid certificates
result = satellite.install(
InstallerCommand(
'certs-update-server',
'certs-update-server-ca',
scenario='satellite',
certs_server_cert='/root/certs/invalid.crt',
certs_server_key='/root/certs/invalid.key',
certs_server_ca_cert=f'"/root/{cert_data["ca_bundle_file_name"]}"',
)
)
# installer should fail with non-zero value
assert result.status != 0

result = satellite.execute('hammer ping')
assert result.status == 0, f'Hammer Ping failed:\n{result.stderr}'

0 comments on commit 838d133

Please sign in to comment.