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 committed Aug 16, 2024
1 parent 3db05bb commit 5dc2c54
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bats/fb-test-backup.bats
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ BACKUP_ONLINE_DIR="${BACKUP_BASE_DIR}/online"
tFileExists "${BACKUP_OFFLINE_DIR}/pulp_data.tar"
}

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

if tPackageExists foreman; then
skip "Stand-alone foreman-proxy test"
fi

tFileExists "${BACKUP_OFFLINE_DIR}/pulp_data.tar"
tFileExists "${BACKUP_OFFLINE_DIR}/pgsql_data.tar.gz"
tar -tvf "${BACKUP_OFFLINE_DIR}/config_files.tar.gz" | grep "${HOSTNAME}.tar.gz"
}

@test "perform online backup" {
tForemanMaintainAvailable

Expand All @@ -66,6 +78,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 +87,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 +97,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" {
tForemanMaintainAvailable

if tPackageExists foreman; then
skip "Stand-alone foreman-proxy test"
fi

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"
}
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 5dc2c54

Please sign in to comment.