diff --git a/bats/fb-test-puppet.bats b/bats/fb-test-puppet.bats index da3ef6dc1..06a72624e 100755 --- a/bats/fb-test-puppet.bats +++ b/bats/fb-test-puppet.bats @@ -115,3 +115,14 @@ fi REPORT_ID=$(hammer --output csv --no-headers config-report list --fields "Id" --search "host=${HOSTNAME} origin=Puppet") hammer config-report info --id "${REPORT_ID%%[[:space:]]*}" | grep "Resource: Puppet" } + +@test "disable puppet" { + KATELLO_VERSION=$(tKatelloVersion) + if [[ $KATELLO_VERSION != 4.[3-9]* ]]; then + skip "Disabling Puppet explicitly is only supported with Katello 4.2 or older" + fi + + if tForemanMaintainCommandAvailable 'plugin purge-puppet'; then + foreman-maintain plugin purge-puppet + fi +} diff --git a/bats/foreman_helper.bash b/bats/foreman_helper.bash index 509f3a98d..f385be0a6 100644 --- a/bats/foreman_helper.bash +++ b/bats/foreman_helper.bash @@ -145,3 +145,11 @@ tWaitForTask() { sleep $(( next_wait_time++ )) done } + +tForemanMaintainCommandAvailable() { + if tForemanMaintainAvailable ; then + if ! foreman-maintain "$1" --help ; then + skip "foreman-maintain $1 is not available" + fi + fi +}