Skip to content

Commit 79a69cf

Browse files
odockaldgolovin
andauthored
chore(ci): add e2e test job that runs against production podman desktop (redhat-developer#300)
* chore(ci): add e2e test job that runs against production podman desktop Signed-off-by: Ondrej Dockal <[email protected]> * change target from compile:current to compile Signed-off-by: Ondrej Dockal <[email protected]> * chore(test): use latest released tests-playwright package Signed-off-by: Ondrej Dockal <[email protected]> --------- Signed-off-by: Ondrej Dockal <[email protected]> Co-authored-by: Denis Golovin <[email protected]>
1 parent c51c64f commit 79a69cf

File tree

2 files changed

+111
-3
lines changed

2 files changed

+111
-3
lines changed

.github/workflows/pr-check.yaml

+97
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,100 @@ jobs:
156156
with:
157157
name: e2e-tests
158158
path: ./**/tests/**/output/
159+
160+
e2e-tests-production:
161+
name: e2e tests production mode
162+
runs-on: ubuntu-24.04
163+
needs: test
164+
env:
165+
SKIP_INSTALLATION: true
166+
steps:
167+
- uses: actions/checkout@v4
168+
with:
169+
path: podman-desktop-redhat-account-ext
170+
171+
- uses: pnpm/action-setup@v4
172+
name: Install pnpm
173+
with:
174+
run_install: false
175+
package_json_file: ./podman-desktop-redhat-account-ext/package.json
176+
177+
- uses: actions/setup-node@v4
178+
with:
179+
node-version: 20
180+
181+
# Checkout podman desktop
182+
- uses: actions/checkout@v4
183+
with:
184+
repository: containers/podman-desktop
185+
ref: main
186+
path: podman-desktop
187+
188+
- name: Update podman
189+
run: |
190+
# ubuntu version from kubic repository to install podman we need (v5)
191+
ubuntu_version='23.04'
192+
sudo sh -c "echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list"
193+
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add -
194+
# install necessary dependencies for criu package which is not part of 23.04
195+
sudo apt-get install -qq libprotobuf32t64 python3-protobuf libnet1
196+
# install criu manually from static location
197+
curl -sLO http://cz.archive.ubuntu.com/ubuntu/pool/universe/c/criu/criu_3.16.1-2_amd64.deb && sudo dpkg -i criu_3.16.1-2_amd64.deb
198+
sudo apt-get update -qq
199+
sudo apt-get -qq -y install podman || { echo "Start fallback steps for podman nightly installation from a static mirror" && \
200+
sudo sh -c "echo 'deb http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list" && \
201+
curl -L "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - && \
202+
sudo apt-get update && \
203+
sudo apt-get -y install podman; }
204+
podman version
205+
206+
- name: Revert unprivileged user namespace restrictions in Ubuntu 24.04
207+
run: |
208+
# allow unprivileged user namespace
209+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
210+
211+
- name: Build Podman Desktop for E2E tests locally in production mode
212+
working-directory: ./podman-desktop
213+
env:
214+
ELECTRON_ENABLE_INSPECT: true
215+
run: |
216+
pnpm install --frozen-lockfile
217+
pnpm compile:current --linux dir
218+
path=$(realpath ./dist/linux-unpacked/podman-desktop)
219+
echo "Podman Desktop built binary: $path"
220+
echo "PODMAN_DESKTOP_BINARY_PATH=$path" >> $GITHUB_ENV
221+
222+
- name: Ensure getting current HEAD version of the test framework
223+
working-directory: ./podman-desktop-redhat-account-ext
224+
run: |
225+
# workaround for https://github.com/containers/podman-desktop-extension-bootc/issues/712
226+
version=$(npm view @podman-desktop/tests-playwright@next version)
227+
echo "Version of @podman-desktop/tests-playwright to be used: $version"
228+
jq --arg version "$version" '.devDependencies."@podman-desktop/tests-playwright" = $version' package.json > package.json_tmp && mv package.json_tmp package.json
229+
230+
- name: Execute pnpm in SSO Extension
231+
working-directory: ./podman-desktop-redhat-account-ext
232+
run: pnpm install --no-frozen-lockfile
233+
234+
- name: Build SSO extension from container file
235+
working-directory: ./podman-desktop-redhat-account-ext
236+
run: |
237+
pnpm build
238+
podman build -t local_sso_image ./
239+
CONTAINER_ID=$(podman create localhost/local_sso_image --entrypoint "")
240+
podman export $CONTAINER_ID > /tmp/local_sso_image.tar
241+
mkdir -p tests/output/sso-tests-pd/plugins
242+
tar -xf /tmp/local_sso_image.tar -C tests/output/sso-tests-pd/plugins/
243+
244+
- name: Run All E2E tests
245+
working-directory: ./podman-desktop-redhat-account-ext
246+
env:
247+
PODMAN_DESKTOP_BINARY: ${{ env.PODMAN_DESKTOP_BINARY_PATH }}
248+
run: |
249+
pnpm test:e2e
250+
251+
- uses: actions/upload-artifact@v4
252+
if: always()
253+
with:
254+
name: e2e-tests-production
255+
path: ./**/tests/**/output/

tests/src/sso-extension.spec.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ test.afterAll(async ({ runner }) => {
4646

4747
test.describe.serial('Red Hat Authentication extension verification', () => {
4848
test.describe.serial('Red Hat Authentication extension installation', () => {
49+
// PR check builds extension locally and so it is available already
4950
test('Go to extensions and check if extension is already installed', async ({ navigationBar }) => {
5051
const extensions = await navigationBar.openExtensions();
5152
if (await extensions.extensionIsInstalled(extensionLabel)) {
@@ -54,12 +55,14 @@ test.describe.serial('Red Hat Authentication extension verification', () => {
5455
});
5556

5657
// we want to skip removing of the extension when we are running tests from PR check
57-
test('Uninstalle previous version of sso extension', async ({ navigationBar }) => {
58+
test('Uninstall previous version of sso extension', async ({ navigationBar }) => {
5859
test.skip(!extensionInstalled || !!skipInstallation);
5960
test.setTimeout(60000);
6061
await removeExtension(navigationBar);
6162
});
6263

64+
// we want to install extension from OCI image (usually using latest tag) after new code was added to the codebase
65+
// and extension was published already
6366
test('Extension can be installed using OCI image', async ({ navigationBar }) => {
6467
test.skip(extensionInstalled && !skipInstallation);
6568
test.setTimeout(200000);
@@ -68,7 +71,7 @@ test.describe.serial('Red Hat Authentication extension verification', () => {
6871
await playExpect(extensionCard.card).toBeVisible();
6972
});
7073

71-
test('Extension card is present and active', async ({ navigationBar }) => {
74+
test('Extension (card) is installed, present and active', async ({ navigationBar }) => {
7275
const extensions = await navigationBar.openExtensions();
7376
await playExpect.poll(async () =>
7477
await extensions.extensionIsInstalled(extensionLabel), { timeout: 30000 },
@@ -77,13 +80,21 @@ test.describe.serial('Red Hat Authentication extension verification', () => {
7780
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
7881
});
7982

80-
test('Extension Details show correct status', async ({ page,navigationBar }) => {
83+
test('Extension\'s details show correct status, no error', async ({ page,navigationBar }) => {
8184
const extensions = await navigationBar.openExtensions();
8285
const extensionCard = await extensions.getInstalledExtension(extensionLabelName, extensionLabel);
8386
await extensionCard.openExtensionDetails('Red Hat Authentication');
8487
const details = new SSOExtensionPage(page);
8588
await playExpect(details.heading).toBeVisible();
8689
await playExpect(details.status).toHaveText(activeExtensionStatus);
90+
const errorTab = details.tabs.getByRole('button', { name: 'Error' });
91+
// we would like to propagate the error's stack trace into test failure message
92+
let stackTrace = '';
93+
if ((await errorTab.count()) > 0) {
94+
await details.activateTab('Error');
95+
stackTrace = await details.errorStackTrace.innerText();
96+
}
97+
await playExpect(errorTab, `Error Tab was present with stackTrace: ${stackTrace}`).not.toBeVisible();
8798
});
8899

89100
test('SSO provider is available in Authentication Page', async ({ navigationBar }) => {

0 commit comments

Comments
 (0)