Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
8 changes: 7 additions & 1 deletion .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,19 @@ jobs:
- job: copr_build
trigger: pull_request
targets:
rhel-9:
rhel-9: &additional_repos
additional_modules: "foreman-devel:el9"
additional_repos:
- https://yum.theforeman.org/releases/nightly/el9/x86_64/
- https://yum.theforeman.org/plugins/nightly/el9/x86_64/
epel-9: *additional_repos
module_hotfixes: true

- job: tests
trigger: pull_request
targets:
- epel-9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be rhel-9? Alternatively we'll probably need to set up additional repos here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be more descriptive please I might not get it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous build failed with this - apparently it tried to build the rpm without having access to the other repositories we supply for the copr_build job.

No matching package to install: 'foreman-assets >= 3.15'
No matching package to install: 'foreman-plugin >= 3.15'
No matching package to install: 'npm(@theforeman/builder) >= 15.0.1'
No matching package to install: 'rubygem(deface)'
No matching package to install: 'rubygem(foreman-tasks) >= 8.3.0'

With the rhel-9 thing, I was hoping that if we used the same target for both of those jobs, things would sort themselves out, but apparently that is not an available target on testing farm, so I'm sorry for that. So back to epel-9 and we'll see where it takes us

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we're back where we were, would something like this change anything?

Suggested change
- epel-9
epel-9:
additional_modules: "foreman-devel:el9"
additional_repos:
- https://yum.theforeman.org/releases/nightly/el9/x86_64/
- https://yum.theforeman.org/plugins/nightly/el9/x86_64/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this is what i saw missing, trying it for now...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

968e68d this seems to be the way forward. It will at least allow the test job to be triggered in testing farm


srpm_build_deps:
- wget
- rubygems
3 changes: 3 additions & 0 deletions tests/rex/rex-uptime/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary: Run uptime command check on the provisioned guest
test: ./test.sh
framework: shell
6 changes: 6 additions & 0 deletions tests/rex/rex-uptime/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail

echo "Running uptime check on the TMT guest"
uptime
echo "Uptime test on guest completed successfully."
2 changes: 2 additions & 0 deletions tests/rex/tmt/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
plans:
name: /plans/rex-uptime.fmf
49 changes: 49 additions & 0 deletions tests/rex/tmt/plans/rex-uptime.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: /plans/rex-uptime
summary: Test Foreman Remote Execution for uptime command

provision:
how: virtual
image: centos-stream-9

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepare:
    how: install
    package:
      - https://yum.theforeman.org/releases/nightly/el9/x86_64/foreman-release.rpm

should setup enough repos to make things install fine

discover:
how: fmf
directory: ../../rex-uptime

execute:
how: tmt
prepare:
- how: shell
name: trigger-and-verify-remote-execution
where: localhost
script:
- |
#!/bin/bash
set -euo pipefail

echo "Foreman Remote Execution Test from TMT Host"
job_template='Run Command - Script Default'
GUEST_IP=$(tmt --root $(tmt _root) guest --id default-0 | grep 'primary address' | awk '{print $NF}')
echo "TMT Guest IP: ${GUEST_IP}"

echo "Triggering 'uptime' command on guest IP ${GUEST_IP} via Foreman"
JOB_INFO=$(hammer job-invocation create \
--job-template "${job_template}" \
--inputs 'command=uptime' \
--search-query "facts.ip_address = ${GUEST_IP}" \
--json)

JOB_ID=$(echo "${JOB_INFO}" | jq -r '.id')
echo "Foreman Job ID: ${JOB_ID}"

echo "Waiting for Foreman job ${JOB_ID} to complete"
for i in $(seq 1 120); do
JOB_STATUS=$(hammer job-invocation info --id "${JOB_ID}" --json | jq -r '.state')
echo "Job status: ${JOB_STATUS} (Attempt ${i})"
[[ "$JOB_STATUS" == "finished" ]] && break
[[ "$JOB_STATUS" == "error" || "$JOB_STATUS" == "failed" ]] && exit 1
sleep 5
done

echo "Foreman job ${JOB_ID} completed successfully."
hammer job-invocation info --id "$JOB_ID"
echo "Foreman Remote Execution Test PASSED"
Loading