Skip to content

Commit 7fa32fd

Browse files
committed
Add a test for disabling puppet
1 parent e718a76 commit 7fa32fd

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

bats/fb-test-puppet.bats

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,14 @@ fi
115115
REPORT_ID=$(hammer --output csv --no-headers config-report list --fields "Id" --search "host=${HOSTNAME} origin=Puppet")
116116
hammer config-report info --id "${REPORT_ID%%[[:space:]]*}" | grep "Resource: Puppet"
117117
}
118+
119+
@test "disable puppet" {
120+
KATELLO_VERSION=$(tKatelloVersion)
121+
if [[ $KATELLO_VERSION != 4.[3-9]* ]]; then
122+
skip "Disabling Puppet explicitly is only supported with Katello 4.2 or older"
123+
fi
124+
125+
if tForemanMaintainCommandAvailable 'plugin purge-puppet'; then
126+
foreman-maintain plugin purge-puppet
127+
fi
128+
}

bats/foreman_helper.bash

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,11 @@ tWaitForTask() {
145145
sleep $(( next_wait_time++ ))
146146
done
147147
}
148+
149+
tForemanMaintainCommandAvailable() {
150+
if tForemanMaintainAvailable ; then
151+
if ! foreman-maintain "$1" --help ; then
152+
skip "foreman-maintain $1 is not available"
153+
fi
154+
fi
155+
}

0 commit comments

Comments
 (0)