chore(ci): Run e2e tests on Testing Farm after merge (#13887)

* chore(ci): add gha workflow to run e2e tests on TF
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: use latest version
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: use commit sha
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: test summary
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: incorporate some comments
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: copyright
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: ai comments
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: check cli versions
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: comment/always upload junit file
Signed-off-by: Anton Misskii <amisskii@redhat.com>

* fix: rename junit file
Signed-off-by: Anton Misskii <amisskii@redhat.com>
This commit is contained in:
Anton Misskii 2025-09-26 12:09:06 +02:00 committed by GitHub
parent 1b4e200384
commit 741a552111
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 620 additions and 0 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

147
.github/workflows/e2e-main-tf.yaml vendored Normal file
View file

@ -0,0 +1,147 @@
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: PD E2E Testing Farm
on:
push:
branches: [main]
workflow_dispatch:
inputs:
fork:
default: 'podman-desktop'
description: 'Podman Desktop repo fork'
type: string
required: true
branch:
default: 'main'
description: 'Podman Desktop repo branch'
type: string
required: true
podman_version:
default: 'nightly'
description: 'Podman version to install (e.g., "5.5.2", "5.6.0~rc1"). Use "latest" for stable or "nightly" for the latest development build.'
type: string
required: true
npm_target:
description: npm tests target
type: choice
default: 'all'
options:
- e2e
- kubernetes
- smoke
- all
jobs:
pd-e2e-testing-farm-ci:
timeout-minutes: 90
name: pd-e2e-testing-farm-ci
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
fedora-version: ['Fedora-41', 'Fedora-42']
steps:
- name: Set the default env. variables
env:
DEFAULT_NPM_TARGET: 'all'
DEFAULT_FORK: 'podman-desktop'
DEFAULT_BRANCH: 'main'
DEFAULT_PODMAN_VERSION: 'nightly'
run: |
echo "NPM_TARGET=${{ github.event.inputs.npm_target || env.DEFAULT_NPM_TARGET }}" >> $GITHUB_ENV
echo "FORK=${{ github.event.inputs.fork || env.DEFAULT_FORK }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
echo "PODMAN_VERSION=${{ github.event.inputs.podman_version || env.DEFAULT_PODMAN_VERSION }}" >> $GITHUB_ENV
- name: Run Podman Desktop Playwright E2E tests on Testing Farm CI
id: run-e2e-tf
uses: sclorg/testing-farm-as-github-action@f3a39272a197ed060d5f786186b0e7a3ee7b0b4f
with:
api_key: ${{ secrets.TF_TOKEN }}
create_github_summary: "false"
compose: ${{ matrix.fedora-version }}
tmt_plan_filter: 'name:/tmt/plans/pd-e2e-plan/${{ env.NPM_TARGET }}'
variables: FORK=${{ env.FORK }};BRANCH=${{ env.BRANCH }};COMPOSE=${{ matrix.fedora-version }};ARCH=x86_64;PODMAN_VERSION=${{ env.PODMAN_VERSION }}
- name: Extract Testing Farm work ID and base URL
if: always()
run: |
TF_ARTIFACTS_URL="${{ steps.run-e2e-tf.outputs.test_log_url }}"
TF_DEFAULT_JUNIT_DEFAULT="${TF_ARTIFACTS_URL}/results-junit.xml"
curl -o results-junit.xml "$TF_DEFAULT_JUNIT_DEFAULT"
TF_WORK_ID=$(grep -o 'work-${{ env.NPM_TARGET }}[^/"]*' results-junit.xml | head -1)
echo "TF_WORK_ID=$TF_WORK_ID" >> $GITHUB_ENV
echo "TF_ARTIFACTS_URL=$TF_ARTIFACTS_URL" >> $GITHUB_ENV
- name: Download Playwright JUnit report from Testing Farm
if: always()
run: |
TF_PLAYWRIGHT_JUNIT_URL="${{ env.TF_ARTIFACTS_URL }}/${{ env.TF_WORK_ID }}/tmt/plans/pd-e2e-plan/${{ env.NPM_TARGET }}/execute/data/guest/default-0/tmt/tests/${{ env.NPM_TARGET }}-test-1/data/junit-results.xml"
curl -o junit-playwright-results.xml "$TF_PLAYWRIGHT_JUNIT_URL"
- name: Publish test report to PR
if: always()
uses: mikepenz/action-junit-report@3585e9575db828022551b4231f165eb59a0e74e3
with:
fail_on_failure: true
include_passed: true
detailed_summary: true
annotate_only: true
require_tests: true
report_paths: '**/junit-playwright-results.xml'
- name: Download test artifacts from Testing Farm
if: failure()
run: |
mkdir -p results
TF_TEST_DATA_URL="${{ env.TF_ARTIFACTS_URL }}/${{ env.TF_WORK_ID }}/tmt/plans/pd-e2e-plan/${{ env.NPM_TARGET }}/execute/data/guest/default-0/tmt/tests/${{ env.NPM_TARGET }}-test-1/data"
TF_TRACES_URL="${TF_TEST_DATA_URL}/traces/"
TF_VIDEOS_URL="${TF_TEST_DATA_URL}/videos/"
echo "Downloading traces"
wget \
--recursive \
--no-parent \
--no-host-directories \
--cut-dirs=10 \
--reject "index.html*" \
--directory-prefix=results \
"$TF_TRACES_URL"
echo "Downloading videos"
wget \
--recursive \
--no-parent \
--no-host-directories \
--cut-dirs=10 \
--reject "index.html*" \
--directory-prefix=results \
"$TF_VIDEOS_URL"
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: testing-farm-artifacts-${{ matrix.fedora-version }}
path: |
results/*
**/junit-playwright-results.xml

111
tmt/plans/pd-e2e-plan.fmf Normal file
View file

@ -0,0 +1,111 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
summary: |
This plan provisions a test environment for running Playwright end-to-end tests against the Podman Desktop application.
It installs all required system dependencies, including GUI libraries,
sets up Node.js with pnpm, and starts Podman rootless service.
discover:
how: fmf
execute:
how: tmt
provision:
hardware:
memory: ">= 16 GB"
cpu:
cores: ">= 4"
disk:
- size: ">= 20 GB"
environment:
SKIP_COMPOSE_ONBOARDING_TEST: true
prepare:
- name: Install required packages
how: shell
script: |
sudo dnf update -y
sudo dnf install -y \
git nodejs npm xorg-x11-server-Xvfb \
nss nspr atk at-spi2-atk cups libXcomposite libXdamage libXfixes libXrandr cairo pango alsa-lib \
gcc-c++ gtk3 passt jq
sudo npm install -g pnpm
echo "NodeJS version: $(node -v)"
echo "npm version: $(npm -v)"
echo "pnpm Version: $(pnpm --version)"
- name: Install podman
how: shell
script: |
bash $TMT_TREE/tmt/scripts/install-podman.sh
- name: Enable and start Podman rootless service
how: shell
script: |
systemctl --user enable podman.socket || exit 1
systemctl --user start podman.socket || exit 1
systemctl --user is-active podman.socket || exit 1
/e2e:
summary: Execute all Playwright E2E tests, excluding those related to Kubernetes.
prepare+:
- name: Install Docker Compose CLI
how: shell
script: bash $TMT_TREE/tmt/scripts/install-docker-compose.sh
discover+:
filter: 'tag:e2e'
/smoke:
summary: Execute smoke Playwright E2E tests.
prepare+:
- name: Install Docker Compose CLI
how: shell
script: bash $TMT_TREE/tmt/scripts/install-docker-compose.sh
discover+:
filter: 'tag:smoke'
/kubernetes:
summary: Execute Kubernetes Playwright E2E tests.
prepare+:
- name: Install Kind CLI
how: shell
script: bash $TMT_TREE/tmt/scripts/install-kind.sh
- name: Install Kubectl
how: shell
script: bash $TMT_TREE/tmt/scripts/install-kubectl.sh
discover+:
filter: 'tag:kubernetes'
/all:
summary: Execute all Playwright E2E tests.
prepare+:
- name: Install Docker Compose CLI
how: shell
script: bash $TMT_TREE/tmt/scripts/install-docker-compose.sh
- name: Install Kind CLI
how: shell
script: bash $TMT_TREE/tmt/scripts/install-kind.sh
- name: Install Kubectl
how: shell
script: bash $TMT_TREE/tmt/scripts/install-kubectl.sh
discover+:
filter: 'tag:all'

View file

@ -0,0 +1,81 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
#!/bin/bash
set -euo pipefail
OUTPUT_DIR="$TMT_TREE/tests/playwright/output/"
cd "$TMT_TEST_DATA"
if [ -f "$OUTPUT_DIR/junit-results.xml" ]; then
cp "$OUTPUT_DIR/junit-results.xml" .
else
echo "Error: junit-results.xml not found"
exit 1
fi
if [ "$1" -eq 0 ]; then
cat <<EOF > ./results.yaml
- name: /tests/$2
result: pass
note:
- "Playwright end-to-end tests completed successfully."
log:
- ../output.txt
- junit-results.xml
EOF
elif [ "$1" -eq 255 ]; then
if [ -d "$OUTPUT_DIR/traces" ]; then
cp -r "$OUTPUT_DIR/traces" .
else
echo "Warning: traces directory does not exist" >&2
fi
if [ -d "$OUTPUT_DIR/videos" ]; then
cp -r "$OUTPUT_DIR/videos" .
else
echo "Warning: videos directory does not exist" >&2
fi
cat <<EOF > ./results.yaml
- name: /tests/$2
result: fail
note:
- "Playwright tests failed."
log:
- ../output.txt
- junit-results.xml
- videos
- traces
EOF
else
echo "Warning: Unexpected exit code: $1, treating as failure" >&2
cat <<EOF > ./results.yaml
- name: /tests/$2
result: fail
note:
- "Tests failed with unexpected exit code: $1"
log:
- ../output.txt
EOF
fi
exit 0

View file

@ -0,0 +1,29 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
#!/bin/bash
set -euo pipefail
DOCKER_COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name)
if [ -z "$DOCKER_COMPOSE_VERSION" ]; then
echo "Failed to fetch Docker Compose version"
exit 1
fi
curl -Lo ./docker-compose https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64
chmod +x ./docker-compose
sudo mv ./docker-compose /usr/local/bin/docker-compose

View file

@ -0,0 +1,30 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
#!/bin/bash
set -euo pipefail
KIND_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r .tag_name)
if [ -z "$KIND_VERSION" ]; then
echo "Failed to fetch Kind version"
exit 1
fi
curl -Lo ./kind https://kind.sigs.k8s.io/dl/${KIND_VERSION}/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind version

View file

@ -0,0 +1,30 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
#!/bin/bash
set -euo pipefail
KUBECTL_VERSION=$(curl -L -s https://dl.k8s.io/release/stable.txt)
if [ -z "$KUBECTL_VERSION" ]; then
echo "Failed to fetch Kubectl version"
exit 1
fi
curl -LO "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version --client

View file

@ -0,0 +1,66 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
#!/bin/bash
set -euo pipefail
# Uninstall a preinstalled Podman version to ensure the desired version will be installed.
sudo dnf remove -y podman
# Construct the download URL for the specific Podman version.
COMPOSE_VERSION="fc$(echo "$COMPOSE" | cut -d'-' -f2)"
CUSTOM_PODMAN_URL="https://kojipkgs.fedoraproject.org//packages/podman/${PODMAN_VERSION}/1.${COMPOSE_VERSION}/${ARCH}/podman-${PODMAN_VERSION}-1.${COMPOSE_VERSION}.${ARCH}.rpm"
# Install Podman based on the requested version:
# - "nightly": latest nightly build from rhcontainerbot/podman-next COPR repository
# - "latest": latest stable release from official Fedora repositories
# - other: install the exact RPM from Fedora Koji
if [[ "$PODMAN_VERSION" == "nightly" ]]; then
sudo dnf copr enable -y rhcontainerbot/podman-next
sudo dnf install -y podman --disablerepo=testing-farm-tag-repository
PODMAN_VERSION="$(dnf --quiet \
--repofrompath=podman-next,https://download.copr.fedorainfracloud.org/results/rhcontainerbot/podman-next/fedora-$(rpm -E %fedora)/${ARCH}/ \
list --showduplicates podman 2>/dev/null | grep dev | tail -n1 | cut -d':' -f2 | cut -d'-' -f1 )"
elif [[ "$PODMAN_VERSION" == "latest" ]]; then
sudo dnf install -y podman --disablerepo=testing-farm-tag-repository
PODMAN_VERSION="$(curl -s https://api.github.com/repos/containers/podman/releases/latest | jq -r .tag_name | sed 's/^v//')"
else
curl -Lo podman.rpm "$CUSTOM_PODMAN_URL"
if [[ $? -ne 0 ]]; then
echo "Error: Failed to download Podman RPM from $CUSTOM_PODMAN_URL"
exit 1
fi
if [[ ! -s podman.rpm ]]; then
echo "Error: Downloaded Podman RPM file is missing or empty."
rm -f podman.rpm
exit 1
fi
sudo dnf install -y ./podman.rpm
rm -f podman.rpm
fi
# Verify that the installed Podman version matches the expected version.
INSTALLED_PODMAN_VERSION="$(podman --version | cut -d' ' -f3)"
NORMALIZED_PODMAN_VERSION="${PODMAN_VERSION//\~/-}"
if [[ "$INSTALLED_PODMAN_VERSION" != "$NORMALIZED_PODMAN_VERSION" ]]; then
echo "Podman version mismatch: expected $NORMALIZED_PODMAN_VERSION but got $INSTALLED_PODMAN_VERSION"
exit 1
fi
echo "Podman installed successfully: $INSTALLED_PODMAN_VERSION"

31
tmt/tests/all-test.fmf Normal file
View file

@ -0,0 +1,31 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
summary: Execute all Playwright E2E tests.
tag:
- all
duration: 2h
result: custom
framework: shell
test: |
set +e
cd $TMT_TREE
pnpm install
pnpm test:e2e:all
EXIT_CODE=$?
bash "$TMT_TREE/tmt/scripts/create-results.sh" "$EXIT_CODE" "all"

31
tmt/tests/e2e-test.fmf Normal file
View file

@ -0,0 +1,31 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
summary: Execute all Playwright end-to-end test, excluding those related to Kubernetes.
tag:
- e2e
duration: 2h
result: custom
framework: shell
test: |
set +e
cd $TMT_TREE
pnpm install
pnpm test:e2e
EXIT_CODE=$?
bash "$TMT_TREE/tmt/scripts/create-results.sh" "$EXIT_CODE" "e2e"

View file

@ -0,0 +1,31 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
summary: Execute Kubernetes-specific Playwright end-to-end tests.
tag:
- kubernetes
duration: 2h
result: custom
framework: shell
test: |
set +e
cd $TMT_TREE
pnpm install
pnpm test:e2e:k8s
EXIT_CODE=$?
bash "$TMT_TREE/tmt/scripts/create-results.sh" "$EXIT_CODE" "k8s"

32
tmt/tests/smoke-test.fmf Normal file
View file

@ -0,0 +1,32 @@
# /**********************************************************************
# Copyright (C) 2025 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ***********************************************************************/
summary: Execute smoke Playwright end-to-end tests.
tag:
- smoke
duration: 2h
result: custom
framework: shell
test: |
set +e
cd $TMT_TREE
pnpm install
pnpm test:e2e:smoke
EXIT_CODE=$?
bash "$TMT_TREE/tmt/scripts/create-results.sh" "$EXIT_CODE" "smoke"