Skip to content

Commit

Permalink
Introduce support for packit testing farm
Browse files Browse the repository at this point in the history
- Adapt our integration tests to be executable by packit in the testing
  farm
- Add support to execute integration tests after RPMs are built when PR
  is added/updated

Fixes: #452
Signed-off-by: Martin Perina <mperina@redhat.com>
  • Loading branch information
mwperina committed Oct 5, 2023
1 parent 5c6a72f commit 9ff6870
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 11 deletions.
18 changes: 14 additions & 4 deletions .packit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,20 @@ jobs:
trigger: pull_request
targets:
- epel-9-x86_64
- fedora-rawhide-aarch64
- fedora-rawhide-i386
- fedora-rawhide-ppc64le
- fedora-rawhide-s390x
# - fedora-rawhide-aarch64
# - fedora-rawhide-i386
# - fedora-rawhide-ppc64le
# - fedora-rawhide-s390x
- fedora-rawhide-x86_64

- job: tests
trigger: pull_request
fmf_path: tests
env:
CONTAINER_USED: integration-test-packit
INSTALL_DEPS: "yes"
LOG_LEVEL: "DEBUG"
targets:
- fedora-rawhide-x86_64

- job: copr_build
Expand Down
24 changes: 24 additions & 0 deletions tests/containers/integration-test-packit
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM quay.io/bluechi/integration-test-base:latest

ARG copr_repo

RUN dnf install -y dnf-plugin-config-manager

RUN dnf copr enable -y $copr_repo

RUN dnf install \
--nogpgcheck \
--nodocs \
bluechi \
bluechi-debuginfo \
bluechi-agent \
bluechi-agent-debuginfo \
bluechi-ctl \
bluechi-ctl-debuginfo \
bluechi-selinux \
python3-bluechi \
-y

RUN dnf -y clean all

CMD [ "/sbin/init" ]
9 changes: 5 additions & 4 deletions tests/plans/tier0.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ provision:
environment:
BLUECHI_IMAGE_NAME: bluechi-image
CONTAINER_USED: integration-test-snapshot
INSTALL_DEPS: no
LOG_LEVEL: INFO
MGR_PORT: 8420
TEST_NET_RANGE: 10.10.0.0/24
prepare:
- name: Set containers setup
how: shell
script: |
bash ./scripts/tests-setup.sh
- name: Prepare containers setup
how: shell
script: |
bash scripts/tests-setup.sh
execute:
how: tmt
report:
Expand Down
26 changes: 23 additions & 3 deletions tests/scripts/tests-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,32 @@

set -x

if [ "$CONTAINER_USED" = "integration-test-snapshot" ]; then
export ARCH="--arch=$(uname -m)"
# Install required dependencies only when asked
if [ "$INSTALL_DEPS" == "yes" ]; then
dnf install \
podman \
python3-dasbus \
python3-podman \
python3-pytest \
python3-pytest-timeout \
-y
fi

# When building from packit testing farm we need to pass correct copr repo to the container
BUILD_ARG=""
if [ "$PACKIT_COPR_PROJECT" != "" ]; then
BUILD_ARG="--build-arg copr_repo=$PACKIT_COPR_PROJECT"
fi

podman build $ARCH -f ./containers/$CONTAINER_USED -t $BLUECHI_IMAGE_NAME .
if [ "$CONTAINER_USED" = "integration-test-snapshot" ]; then
BUILD_ARG="${BUILD_ARG} --arch=$(uname -m)"
fi

podman build \
${BUILD_ARG} \
-f ./containers/$CONTAINER_USED \
-t $BLUECHI_IMAGE_NAME \
.
if [[ $? -ne 0 ]]; then
exit 1
fi
Expand Down

0 comments on commit 9ff6870

Please sign in to comment.