Skip to content

Commit 804358f

Browse files
authored
Merge pull request #155 from odockal/issue-93
chore(ci): add PR check e2e linux workflow
2 parents 3504e03 + ee75636 commit 804358f

File tree

2 files changed

+101
-5
lines changed

2 files changed

+101
-5
lines changed

Diff for: .github/workflows/pr-check.yaml

+93
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,96 @@ jobs:
8585

8686
- name: Run unit tests
8787
run: yarn test
88+
89+
e2e-tests:
90+
name: e2e tests
91+
runs-on: ubuntu-24.04
92+
needs: test
93+
env:
94+
SKIP_INSTALLATION: true
95+
steps:
96+
- uses: actions/checkout@v4
97+
with:
98+
path: podman-desktop-redhat-account-ext
99+
- uses: actions/setup-node@v4
100+
with:
101+
node-version: 20
102+
103+
# Checkout podman desktop
104+
- uses: actions/checkout@v4
105+
with:
106+
repository: containers/podman-desktop
107+
ref: main
108+
path: podman-desktop
109+
110+
- name: Update podman
111+
run: |
112+
# ubuntu version from kubic repository to install podman we need (v5)
113+
ubuntu_version='23.04'
114+
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"
115+
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add -
116+
# install necessary dependencies for criu package which is not part of 23.04
117+
sudo apt-get install -qq libprotobuf32t64 python3-protobuf libnet1
118+
# install criu manually from static location
119+
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
120+
sudo apt-get update -qq
121+
sudo apt-get -qq -y install podman || { echo "Start fallback steps for podman nightly installation from a static mirror" && \
122+
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" && \
123+
curl -L "http://ftp.lysator.liu.se/pub/opensuse/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | sudo apt-key add - && \
124+
sudo apt-get update && \
125+
sudo apt-get -y install podman; }
126+
podman version
127+
128+
- name: Revert unprivileged user namespace restrictions in Ubuntu 24.04
129+
run: |
130+
# allow unprivileged user namespace
131+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
132+
133+
- name: Build Podman Desktop for E2E tests
134+
working-directory: ./podman-desktop
135+
run: |
136+
yarn --frozen-lockfile
137+
yarn test:e2e:build
138+
139+
- name: Get yarn cache directory path
140+
working-directory: ./podman-desktop-redhat-account-ext
141+
id: yarn-cache-dir-path
142+
run: echo "dir=$(yarn cache dir)" >> ${GITHUB_OUTPUT}
143+
144+
- uses: actions/cache@v4
145+
id: yarn-cache
146+
with:
147+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
148+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
149+
restore-keys: |
150+
${{ runner.os }}-yarn-
151+
152+
- name: Ensure getting current HEAD version of the test framework
153+
working-directory: ./podman-desktop-redhat-account-ext
154+
run: yarn add -D @podman-desktop/tests-playwright@next
155+
156+
- name: Execute yarn in SSO Extension
157+
working-directory: ./podman-desktop-redhat-account-ext
158+
run: yarn --frozen-lockfile
159+
160+
- name: Build SSO extension from container file
161+
working-directory: ./podman-desktop-redhat-account-ext
162+
run: |
163+
yarn build
164+
podman build -t local_sso_image ./
165+
CONTAINER_ID=$(podman create localhost/local_sso_image --entrypoint "")
166+
podman export $CONTAINER_ID > /tmp/local_sso_image.tar
167+
mkdir -p tests/output/sso-tests-pd/plugins
168+
tar -xf /tmp/local_sso_image.tar -C tests/output/sso-tests-pd/plugins/
169+
170+
- name: Run All E2E tests
171+
working-directory: ./podman-desktop-redhat-account-ext
172+
env:
173+
PODMAN_DESKTOP_ARGS: ${{ github.workspace }}/podman-desktop
174+
run: yarn test:e2e
175+
176+
- uses: actions/upload-artifact@v4
177+
if: always()
178+
with:
179+
name: e2e-tests
180+
path: ./**/tests/output/

Diff for: tests/src/sso-extension.spec.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ const extensionLabelName = 'redhat-authentication';
3434
const authProviderName = 'Red Hat SSO';
3535
const activeExtensionStatus = 'ACTIVE';
3636
const disabledExtensionStatus = 'DISABLED';
37-
37+
const skipInstallation = process.env.SKIP_INSTALLATION ? process.env.SKIP_INSTALLATION : false;
3838

3939
beforeEach<RunnerTestContext>(async ctx => {
4040
ctx.pdRunner = pdRunner;
4141
});
4242

4343
beforeAll(async () => {
44-
pdRunner = new PodmanDesktopRunner();
44+
pdRunner = new PodmanDesktopRunner({ customFolder: 'sso-tests-pd', autoUpdate: false, autoCheckUpdate: false });
4545
page = await pdRunner.start();
4646
pdRunner.setVideoAndTraceName('sso-e2e');
4747

@@ -64,23 +64,26 @@ describe('Red Hat Authentication extension verification', async () => {
6464
}
6565
});
6666

67-
test.runIf(extensionInstalled)(
67+
// we want to skip removing of the extension when we are running tests from PR check
68+
test.runIf(extensionInstalled && !skipInstallation)(
6869
'Uninstalled previous version of sso extension',
6970
async () => {
7071
await removeExtension();
7172
},
7273
60000,
7374
);
7475

75-
test('Extension can be installed using OCI image', async () => {
76+
test.runIf(!skipInstallation)('Extension can be installed using OCI image', async () => {
7677
const extensions = await navBar.openExtensions();
7778
await extensions.installExtensionFromOCIImage(imageName);
7879
await playExpect(extensionCard.card).toBeVisible();
7980
}, 200000);
8081

8182
test('Extension card is present and active', async () => {
8283
const extensions = await navBar.openExtensions();
83-
playExpect(await extensions.extensionIsInstalled(extensionLabel)).toBeTruthy();
84+
await playExpect.poll(async () =>
85+
await extensions.extensionIsInstalled(extensionLabel), { timeout: 30000 }
86+
).toBeTruthy();
8487
const extensionCard = await extensions.getInstalledExtension(extensionLabelName, extensionLabel);
8588
await playExpect(extensionCard.status).toHaveText(activeExtensionStatus);
8689
});

0 commit comments

Comments
 (0)