Skip to content

Commit

Permalink
Add backup tests for foreman-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms authored and evgeni committed Aug 20, 2024
1 parent 3db05bb commit e9a498d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 0 deletions.
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} }}"

0 comments on commit e9a498d

Please sign in to comment.