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 27, 2023
1 parent 4916412 commit ced55bb
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .packit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ jobs:
- fedora-rawhide-s390x
- fedora-rawhide-x86_64

- job: tests
trigger: pull_request
fmf_path: tests
env:
CONTAINER_USED: integration-test-packit
INSTALL_DEPS: "yes"
targets:
# Run integration tests on Fedora using CS9 containers, because running integrations tests on CS9 using CS9
# containers is very flaky
- fedora-rawhide-x86_64

- job: copr_build
trigger: commit
owner: '@centos-automotive-sig'
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 @@ -9,14 +9,15 @@ environment:
BLUECHI_CTRL_SVC_PORT: 8420
BLUECHI_IMAGE_NAME: bluechi-image
CONTAINER_USED: integration-test-snapshot
INSTALL_DEPS: no
LOG_LEVEL: INFO
WITH_COVERAGE: 0
WITH_VALGRIND: 0
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 ced55bb

Please sign in to comment.