Skip to content

Commit 34c7b88

Browse files
committed
configure tmt to provision virtual guest
1 parent fce57d0 commit 34c7b88

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

main.fmf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

plans/rex-uptime.fmf

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
summary: Run uptime command via remote execution
2+
3+
discover:
4+
how: fmf
5+
directory: ./tests
6+
27
execute:
38
how: tmt
4-
test: rex-uptime
9+
10+
provision:
11+
how: virtual
12+
image: centos-stream-9

tests/rex-uptime/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ echo "Running remote execution test: uptime"
55

66
job_template='Run Command - Script Default'
77
SMART_PROXY_NAME=$(hostname -f)
8+
ORG="Test Org"
89
REX_ORG="Remote Execution Org $$"
910

1011
OLD_ORGS=$(hammer --output csv --no-headers --show-ids proxy info --name "${SMART_PROXY_NAME}" --fields Organizations)
@@ -18,4 +19,15 @@ hammer job-invocation create \
1819
--inputs 'command=uptime' \
1920
--search-query "name = ${SMART_PROXY_NAME}"
2021

22+
JOB_ID=$(hammer --csv job-invocation list | grep "${job_template}" | head -n1 | cut -d',' -f1)
23+
24+
STATUS=$(hammer --csv job-invocation info --id "$JOB_ID" | grep '^Status,' | cut -d',' -f2)
25+
26+
if [[ "$STATUS" == "Succeeded" || "$STATUS" == "Finished" ]]; then
27+
echo "Remote job succeeded"
28+
else
29+
echo "Remote job failed with status: $STATUS"
30+
exit 1
31+
fi
32+
2133
echo "Test completed successfully."

0 commit comments

Comments
 (0)