Skip to content

Commit 76e6799

Browse files
committed
test(e2e): move test case to azure runner
Signed-off-by: Daniel Villanueva <davillan@redhat.com>
1 parent 44966cc commit 76e6799

File tree

4 files changed

+425
-115
lines changed

4 files changed

+425
-115
lines changed

.github/workflows/e2e-windows.yaml

Lines changed: 266 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,266 @@
1+
#
2+
# Copyright (C) 2025 Red Hat, Inc.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
# SPDX-License-Identifier: Apache-2.0
17+
18+
name: e2e-main-windows
19+
20+
on:
21+
push:
22+
branches:
23+
- main
24+
25+
workflow_dispatch:
26+
inputs:
27+
fork:
28+
default: 'podman-desktop'
29+
description: 'Podman Desktop repo fork'
30+
type: string
31+
required: true
32+
branch:
33+
default: 'main'
34+
description: 'Podman Desktop repo branch'
35+
type: string
36+
required: true
37+
ext_repo_options:
38+
default: 'REPO=crc-extension,FORK=crc-org,BRANCH=main'
39+
description: 'Podman Desktop Extension repo, fork and branch'
40+
type: string
41+
required: true
42+
ext_tests:
43+
default: '1'
44+
description: 'Run E2E tests from extension'
45+
type: string
46+
required: true
47+
npm_target:
48+
default: 'test:e2e:cluster-deployment'
49+
description: 'npm target to run tests'
50+
type: string
51+
required: true
52+
podman_remote_url:
53+
default: 'https://github.com/containers/podman/releases/download/v5.3.2/podman-remote-release-windows_amd64.zip'
54+
description: 'podman remote zip'
55+
type: string
56+
required: true
57+
podman_version:
58+
default: '5.3.2'
59+
description: 'Podman folder version in archive'
60+
type: 'string'
61+
required: true
62+
podman_options:
63+
default: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0'
64+
description: 'Podman machine configuration options, no spaces'
65+
type: 'string'
66+
required: true
67+
env_vars:
68+
default: 'TEST_PODMAN_MACHINE=false'
69+
description: 'Env. Variables passed into target machine, ie: VAR1=xxx,VAR2=true,VAR3=15,VAR4="Pass me along"'
70+
type: 'string'
71+
required: true
72+
host_params:
73+
default: 'CPUS="8",MEMORY="16"'
74+
description: Number of CPUs and GBs of memory, no spaces
75+
type: 'string'
76+
required: true
77+
78+
jobs:
79+
windows:
80+
name: windows-${{ matrix.windows-version }}-${{ matrix.windows-featurepack }}
81+
runs-on: ubuntu-latest
82+
env:
83+
MAPT_VERSION: v0.7.3
84+
MAPT_IMAGE: quay.io/redhat-developer/mapt
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
windows-version: ['10','11']
89+
windows-featurepack: ['22h2-ent', '24h2-ent']
90+
exclude:
91+
- windows-version: '10'
92+
windows-featurepack: '24h2-ent'
93+
- windows-version: '11'
94+
windows-featurepack: '22h2-ent'
95+
96+
97+
steps:
98+
- name: Get Podman version used by Podman Desktop
99+
run: |
100+
version=$(curl https://raw.githubusercontent.com/podman-desktop/podman-desktop/main/extensions/podman/packages/extension/src/podman5.json | jq -r '.version')
101+
echo "Default Podman Version from Podman Desktop: ${version}"
102+
echo "PD_PODMAN_VERSION=${version}" >> $GITHUB_ENV
103+
- name: Set the default env. variables
104+
env:
105+
DEFAULT_FORK: 'podman-desktop'
106+
DEFAULT_BRANCH: 'main'
107+
DEFAULT_EXT_TESTS: '1'
108+
DEFAULT_NPM_TARGET: 'test:e2e:cluster-deployment'
109+
DEFAULT_ENV_VARS: 'TEST_PODMAN_MACHINE=false'
110+
DEFAULT_PODMAN_OPTIONS: 'INIT=1,START=1,ROOTFUL=1,NETWORKING=0'
111+
DEFAULT_EXT_REPO_OPTIONS: 'REPO=crc-extension,FORK=crc-org,BRANCH=main'
112+
DEFAULT_VERSION: "${{ env.PD_PODMAN_VERSION || '5.3.2' }}"
113+
DEFAULT_URL: "https://github.com/containers/podman/releases/download/v$DEFAULT_VERSION/podman-remote-release-windows_amd64.zip"
114+
DEFAULT_HOST_PARAMS: 'CPUS="8",MEMORY="16"'
115+
run: |
116+
echo "FORK=${{ github.event.inputs.fork || env.DEFAULT_FORK }}" >> $GITHUB_ENV
117+
echo "BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
118+
echo "NPM_TARGET=${{ github.event.inputs.npm_target || env.DEFAULT_NPM_TARGET }}" >> $GITHUB_ENV
119+
echo "ENV_VARS=${{ github.event.inputs.env_vars || env.DEFAULT_ENV_VARS }}" >> $GITHUB_ENV
120+
echo "PODMAN_VERSION=${{ github.event.inputs.podman_version || env.DEFAULT_VERSION }}" >> $GITHUB_ENV
121+
echo "PODMAN_URL=${{ github.event.inputs.podman_remote_url || env.DEFAULT_URL }}" >> $GITHUB_ENV
122+
echo "EXT_TESTS=${{ github.event.inputs.ext_tests || env.DEFAULT_EXT_TESTS }}" >> $GITHUB_ENV
123+
echo "${{ github.event.inputs.host_params || env.DEFAULT_HOST_PARAMS }}" | awk -F ',' \
124+
'{for (i=1; i<=NF; i++) {split($i, kv, "="); print "HOST_PARAMS_"kv[1]"="kv[2]}}' >> $GITHUB_ENV
125+
echo "${{ github.event.inputs.podman_options || env.DEFAULT_PODMAN_OPTIONS }}" | awk -F ',' \
126+
'{for (i=1; i<=NF; i++) {split($i, kv, "="); print "PODMAN_"kv[1]"="kv[2]}}' >> $GITHUB_ENV
127+
echo "${{ github.event.inputs.ext_repo_options || env.DEFAULT_EXT_REPO_OPTIONS }}" | awk -F ',' \
128+
'{for (i=1; i<=NF; i++) {split($i, kv, "="); print "EXT_"kv[1]"="kv[2]}}' >> $GITHUB_ENV
129+
130+
- name: Create instance
131+
run: |
132+
# Create instance
133+
podman run -d --name windows-create --rm \
134+
-v ${PWD}:/workspace:z \
135+
-e ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} \
136+
-e ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} \
137+
-e ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} \
138+
-e ARM_CLIENT_SECRET='${{ secrets.ARM_CLIENT_SECRET }}' \
139+
${{ env.MAPT_IMAGE }}:${{ env.MAPT_VERSION }} azure \
140+
windows create \
141+
--project-name 'windows-desktop' \
142+
--backed-url 'file:///workspace' \
143+
--conn-details-output '/workspace' \
144+
--windows-version '${{ matrix.windows-version }}' \
145+
--windows-featurepack '${{ matrix.windows-featurepack }}' \
146+
--nested-virt \
147+
--cpus '${{ env.HOST_PARAMS_CPUS }}' \
148+
--memory '${{ env.HOST_PARAMS_MEMORY }}' \
149+
--tags project=podman-desktop,source=github,org=${{github.repository_owner}},run=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \
150+
--spot
151+
# Check logs
152+
podman logs -f windows-create
153+
154+
- name: Check instance system info
155+
run: |
156+
ssh -i id_rsa \
157+
-o StrictHostKeyChecking=no \
158+
-o UserKnownHostsFile=/dev/null \
159+
-o ServerAliveInterval=30 \
160+
-o ServerAliveCountMax=1200 \
161+
$(cat username)@$(cat host) "systeminfo"
162+
163+
- name: Emulate X session
164+
run: |
165+
# use fake rdp to emulate an active x session
166+
podman run -d --name x-session \
167+
-e RDP_HOST=$(cat host) \
168+
-e RDP_USER=$(cat username) \
169+
-e RDP_PASSWORD=$(cat userpassword) \
170+
quay.io/rhqp/frdp:v0.0.1
171+
# Wait until the x session has been created
172+
podman wait --condition running x-session
173+
# Check logs for the x session
174+
podman logs x-session
175+
176+
- name: Download Podman, do not initialize
177+
run: |
178+
podman run --rm -d --name pde2e-podman-run \
179+
-e TARGET_HOST=$(cat host) \
180+
-e TARGET_HOST_USERNAME=$(cat username) \
181+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
182+
-e TARGET_FOLDER=pd-e2e \
183+
-e TARGET_RESULTS=results \
184+
-e OUTPUT_FOLDER=/data \
185+
-e DEBUG=true \
186+
-v $PWD:/data:z \
187+
quay.io/odockal/pde2e-podman:v0.0.1-windows \
188+
pd-e2e/podman.ps1 \
189+
-downloadUrl ${{ env.PODMAN_URL }} \
190+
-version ${{ env.PODMAN_VERSION }} \
191+
-targetFolder pd-e2e \
192+
-resultsFolder results \
193+
-initialize 0 \
194+
-rootful 0 \
195+
-start 0 \
196+
-installWSL 0
197+
# check logs
198+
podman logs -f pde2e-podman-run
199+
200+
- name: Run OpenShift Local Extension Playwright E2E tests
201+
run: |
202+
podman run -d --name pde2e-runner-run \
203+
-e TARGET_HOST=$(cat host) \
204+
-e TARGET_HOST_USERNAME=$(cat username) \
205+
-e TARGET_HOST_KEY_PATH=/data/id_rsa \
206+
-e TARGET_FOLDER=pd-e2e \
207+
-e TARGET_RESULTS=results \
208+
-e OUTPUT_FOLDER=/data \
209+
-e DEBUG=true \
210+
-v $PWD:/data:z \
211+
quay.io/odockal/pde2e-runner:v0.0.1-windows \
212+
pd-e2e/runner.ps1 \
213+
-targetFolder pd-e2e \
214+
-resultsFolder results \
215+
-podmanPath $(cat results/podman-location.log) \
216+
-fork ${{ env.FORK }} \
217+
-branch ${{ env.BRANCH }} \
218+
-extRepo ${{ env.EXT_REPO }} \
219+
-extFork ${{ env.EXT_FORK }} \
220+
-extBranch ${{ env.EXT_BRANCH }} \
221+
-extTests ${{ env.EXT_TESTS }} \
222+
-npmTarget ${{ env.NPM_TARGET }} \
223+
-initialize 1 \
224+
-rootful 1 \
225+
-start 1 \
226+
-userNetworking ${{ env.PODMAN_NETWORKING }} \
227+
-envVars ${{ env.ENV_VARS }} \
228+
# check logs
229+
podman logs -f pde2e-runner-run
230+
231+
- name: Destroy instance
232+
if: always()
233+
run: |
234+
# Destroy instance
235+
podman run -d --name windows-destroy --rm \
236+
-v ${PWD}:/workspace:z \
237+
-e ARM_TENANT_ID=${{ secrets.ARM_TENANT_ID }} \
238+
-e ARM_SUBSCRIPTION_ID=${{ secrets.ARM_SUBSCRIPTION_ID }} \
239+
-e ARM_CLIENT_ID=${{ secrets.ARM_CLIENT_ID }} \
240+
-e ARM_CLIENT_SECRET='${{ secrets.ARM_CLIENT_SECRET }}' \
241+
${{ env.MAPT_IMAGE }}:${{ env.MAPT_VERSION }} azure \
242+
windows destroy \
243+
--project-name 'windows-desktop' \
244+
--backed-url 'file:///workspace'
245+
# Check logs
246+
podman logs -f windows-destroy
247+
248+
- name: Publish Test Report
249+
uses: mikepenz/action-junit-report@v5
250+
if: always() # always run even if the previous step fails
251+
with:
252+
fail_on_failure: true
253+
include_passed: true
254+
detailed_summary: true
255+
require_tests: true
256+
annotate_only: true
257+
report_paths: '**/*results.xml'
258+
259+
- name: Upload test artifacts
260+
uses: actions/upload-artifact@v4
261+
if: always()
262+
with:
263+
name: results-e2e-${{ matrix.windows-version }}${{ matrix.windows-featurepack }}
264+
path: |
265+
results/*
266+

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,15 @@
140140
"desk:run": "ts-node-esm ./scripts/run.mts run",
141141
"test": "vitest run --coverage --passWithNoTests",
142142
"test:e2e:setup": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' --",
143-
"test:e2e": "npm run test:e2e:setup npx playwright test tests/src"
143+
"test:e2e": "npm run test:e2e:setup npx playwright test tests/src --grep-invert @cluster-deployment",
144+
"test:e2e:cluster-deployment": "npm run test:e2e:build && npm run test:e2e:cluster-deployment:run",
145+
"test:e2e:cluster-deployment:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/src -g @cluster-deployment"
144146
},
145147
"dependencies": {
146148
"@redhat-developer/rhaccm-client": "^0.0.1"
147149
},
148150
"devDependencies": {
151+
"@playwright/test": "^1.49.1",
149152
"@podman-desktop/api": "1.14.1",
150153
"@playwright/test": "^1.50.0",
151154
"@podman-desktop/tests-playwright": "next",

0 commit comments

Comments
 (0)