Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backup tests for foreman-proxy #1838

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions bats/fb-test-backup.bats
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ BACKUP_ONLINE_DIR="${BACKUP_BASE_DIR}/online"
tFileExists "${BACKUP_OFFLINE_DIR}/pulp_data.tar"
}

@test "check offline backup contents for Foreman Proxy Content" {
tForemanMaintainAvailable

if ! tPackageExists foreman && tPackageExists foreman-installer-katello; then
tFileExists "${BACKUP_OFFLINE_DIR}/pulp_data.tar"
tar -tvf "${BACKUP_OFFLINE_DIR}/config_files.tar.gz" | grep "${HOSTNAME}.tar.gz"

FOREMAN_VERSION=$(tForemanVersion)
if tIsVersionNewer "${FOREMAN_VERSION}" 3.12; then
tFileExists "${BACKUP_OFFLINE_DIR}/pulpcore.dump"
else
tFileExists "${BACKUP_OFFLINE_DIR}/pgsql_data.tar.gz"
fi
else
skip "Stand-alone foreman-proxy with content test"
fi
}

@test "perform online backup" {
tForemanMaintainAvailable

Expand All @@ -66,6 +84,7 @@ BACKUP_ONLINE_DIR="${BACKUP_BASE_DIR}/online"

@test "check online backup contests for Foreman" {
tForemanMaintainAvailable
tForemanAvailable

tFileExists "${BACKUP_ONLINE_DIR}/config_files.tar.gz"
tFileExists "${BACKUP_ONLINE_DIR}/metadata.yml"
Expand All @@ -74,6 +93,7 @@ BACKUP_ONLINE_DIR="${BACKUP_BASE_DIR}/online"

@test "check online backup contents for Katello" {
tForemanMaintainAvailable
tForemanAvailable

if ! tPackageExists foreman-installer-katello; then
skip "Katello specific test"
Expand All @@ -83,3 +103,15 @@ BACKUP_ONLINE_DIR="${BACKUP_BASE_DIR}/online"
tFileExists "${BACKUP_ONLINE_DIR}/candlepin.dump"
tFileExists "${BACKUP_ONLINE_DIR}/pulpcore.dump"
}

@test "check online backup contents for Foreman Proxy Content" {
tForemanMaintainAvailable

if ! tPackageExists foreman && tPackageExists foreman-installer-katello; then
tFileExists "${BACKUP_ONLINE_DIR}/pulp_data.tar"
tFileExists "${BACKUP_ONLINE_DIR}/pulpcore.dump"
tar -tvf "${BACKUP_ONLINE_DIR}/config_files.tar.gz" | grep "${HOSTNAME}.tar.gz"
else
skip "Stand-alone foreman-proxy with content test"
fi
}
4 changes: 4 additions & 0 deletions bats/foreman_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,7 @@ tHammerPing() {

[[ "$status" -eq 0 ]]
}

tForemanAvailable() {
tPackageExists foreman || skip 'foreman package is not available'
}
1 change: 1 addition & 0 deletions pipelines/install/05-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- name: run tests
hosts:
- "{{ forklift_server_name }}"
- "{{ forklift_proxy_name }}"
become: true
vars_files:
- ../vars/install_base.yml
Expand Down
3 changes: 3 additions & 0 deletions pipelines/vars/forklift_katello.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ proxy_box:
- "foreman-installer-katello"
foreman_installer_options:
- "--foreman-proxy-content-enable-ostree true"
bats_tests:
- fb-test-backup.bats
bats_teardown: []
forklift_boxes:
"{{ {forklift_server_name: server_box, forklift_proxy_name: proxy_box, forklift_smoker_name: smoker_box} }}"
3 changes: 3 additions & 0 deletions pipelines/vars/forklift_luna.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@ proxy_box:
- "--enable-foreman-proxy-plugin-openscap"
- "--enable-foreman-proxy-plugin-remote-execution-script"
- "--foreman-proxy-content-enable-ostree true"
bats_tests:
- fb-test-backup.bats
bats_teardown: []
forklift_boxes:
"{{ {forklift_server_name: server_box, forklift_proxy_name: proxy_box, forklift_smoker_name: smoker_box} }}"
Loading