Skip to content

Commit 318d888

Browse files
authored
chore(test): run Kubernetes e2e tests with Docker provider on GitHub Actions Linux runner (podman-desktop#10773)
* chore(test): run Kubernetes e2e tests with Docker provider on GitHub Actions Linux runner Signed-off-by: Anton Misskii <[email protected]> * fix: fix Signed-off-by: Anton Misskii <[email protected]>
1 parent cd3c7b3 commit 318d888

7 files changed

+69
-30
lines changed

.github/workflows/e2e-kubernetes-main.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ on:
3838
description: 'Podman Desktop repo branch'
3939
type: string
4040
required: true
41+
kind_provider:
42+
description: 'Kind cluster provider type'
43+
type: choice
44+
options:
45+
- docker
46+
- podman
47+
required: true
4148

4249
jobs:
4350
e2e-tests:
@@ -53,6 +60,12 @@ jobs:
5360
- uses: actions/checkout@v4
5461
if: github.event_name == 'push'
5562

63+
- name: Set the default provider type variable
64+
env:
65+
DEFAULT_KIND_PROVIDER: 'docker'
66+
run: |
67+
echo "KIND_PROVIDER=${{ github.event.inputs.kind_provider || env.DEFAULT_KIND_PROVIDER }}" >> $GITHUB_ENV
68+
5669
- name: Update podman
5770
run: |
5871
echo "ubuntu version from kubic repository to install podman we need (v5)"
@@ -106,6 +119,7 @@ jobs:
106119
PODMANDESKTOP_CI_BOT_TOKEN: ${{ secrets.PODMANDESKTOP_CI_BOT_TOKEN }}
107120
TEST_PODMAN_MACHINE: 'true'
108121
SKIP_KIND_INSTALL: 'true'
122+
KIND_PROVIDER_GHA: ${{ env.KIND_PROVIDER }}
109123
ELECTRON_ENABLE_INSPECT: true
110124
run: |
111125
echo "Compiling the Podman Desktop in production mode"

.github/workflows/e2e-main.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ on:
4343
description: 'Podman Desktop repo branch'
4444
type: string
4545
required: true
46+
kind_provider:
47+
description: 'Kind cluster provider type'
48+
type: choice
49+
options:
50+
- docker
51+
- podman
52+
required: false
4653

4754
jobs:
4855
e2e-tests:
@@ -58,11 +65,13 @@ jobs:
5865
- uses: actions/checkout@v4
5966
if: github.event_name == 'push'
6067

61-
- name: Set the default npm target variable
68+
- name: Set the default env. variables
6269
env:
6370
DEFAULT_NPM_TARGET: 'test:e2e'
71+
DEFAULT_KIND_PROVIDER: 'docker'
6472
run: |
6573
echo "NPM_TARGET=${{ github.event.inputs.npm_target || env.DEFAULT_NPM_TARGET }}" >> $GITHUB_ENV
74+
echo "KIND_PROVIDER=${{ github.event.inputs.kind_provider || env.DEFAULT_KIND_PROVIDER }}" >> $GITHUB_ENV
6675
6776
- name: Update podman
6877
run: |
@@ -111,18 +120,13 @@ jobs:
111120

112121
- name: Execute pnpm
113122
run: pnpm install
114-
115-
- name: Create Kind Cluster
116-
uses: helm/[email protected]
117-
if: ${{ env.NPM_TARGET == 'test:e2e:all' }}
118-
with:
119-
cluster_name: 'kind-cluster'
120123

121124
- name: Run E2E tests in Production Mode
122125
env:
123126
PODMANDESKTOP_CI_BOT_TOKEN: ${{ secrets.PODMANDESKTOP_CI_BOT_TOKEN }}
124127
TEST_PODMAN_MACHINE: 'true'
125128
SKIP_KIND_INSTALL: 'true'
129+
KIND_PROVIDER_GHA: ${{ env.KIND_PROVIDER }}
126130
ELECTRON_ENABLE_INSPECT: true
127131
run: |
128132
echo "Compiling the Podman Desktop in production mode"

tests/playwright/src/model/pages/create-kind-cluster-page.ts

+20-10
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { CreateClusterBasePage } from './cluster-creation-base-page';
2626
export class CreateKindClusterPage extends CreateClusterBasePage {
2727
readonly clusterNameField: Locator;
2828
readonly controllerCheckbox: Locator;
29-
readonly providerTypeCombobox: Locator;
29+
readonly providerType: Locator;
3030
readonly httpPort: Locator;
3131
readonly httpsPort: Locator;
3232
readonly containerImage: Locator;
@@ -40,7 +40,7 @@ export class CreateKindClusterPage extends CreateClusterBasePage {
4040
name: 'Setup an ingress controller',
4141
})
4242
.locator('..');
43-
this.providerTypeCombobox = this.clusterPropertiesInformation.getByLabel('Provider Type');
43+
this.providerType = this.clusterPropertiesInformation.getByLabel('Provider Type');
4444
this.httpPort = this.clusterPropertiesInformation.getByLabel('HTTP Port');
4545
this.httpsPort = this.clusterPropertiesInformation.getByLabel('HTTPS Port');
4646
this.containerImage = this.clusterPropertiesInformation.getByPlaceholder('Leave empty for using latest.');
@@ -49,7 +49,7 @@ export class CreateKindClusterPage extends CreateClusterBasePage {
4949
public async createClusterDefault(clusterName: string = 'kind-cluster', timeout?: number): Promise<void> {
5050
return test.step('Create default cluster', async () => {
5151
await fillTextbox(this.clusterNameField, clusterName);
52-
await playExpect(this.providerTypeCombobox).toContainText('podman');
52+
await playExpect(this.providerType).toHaveText('podman');
5353
await playExpect(this.httpPort).toHaveValue('9090');
5454
await playExpect(this.httpsPort).toHaveValue('9443');
5555
await playExpect(this.controllerCheckbox).toBeChecked();
@@ -67,21 +67,30 @@ export class CreateKindClusterPage extends CreateClusterBasePage {
6767
await fillTextbox(this.clusterNameField, clusterName);
6868

6969
if (providerType) {
70-
await playExpect(this.providerTypeCombobox).toBeVisible();
71-
const providerTypeOptions = await this.providerTypeCombobox.locator('option').allInnerTexts();
72-
if (providerTypeOptions.includes(providerType)) {
73-
await this.providerTypeCombobox.selectOption({ value: providerType });
74-
await playExpect(this.providerTypeCombobox).toHaveValue(providerType);
75-
} else {
76-
throw new Error(`${providerType} doesn't exist`);
70+
try {
71+
await playExpect(this.providerType).toBeVisible();
72+
if (providerType !== 'podman') {
73+
await this.providerType.click();
74+
const providerTypeButton = this.clusterPropertiesInformation.getByRole('button', {
75+
name: providerType,
76+
exact: true,
77+
});
78+
await playExpect(providerTypeButton).toBeEnabled();
79+
await providerTypeButton.click();
80+
}
81+
await playExpect(this.providerType).toHaveText(providerType);
82+
} catch {
83+
throw new Error(`Provider type '${providerType}' doesn't exist`);
7784
}
7885
}
7986

8087
if (httpPort) {
8188
await fillTextbox(this.httpPort, httpPort);
89+
await playExpect(this.httpPort).toHaveText(httpPort);
8290
}
8391
if (httpsPort) {
8492
await fillTextbox(this.httpsPort, httpsPort);
93+
await playExpect(this.httpsPort).toHaveText(httpsPort);
8594
}
8695

8796
await playExpect(this.controllerCheckbox).toBeEnabled();
@@ -95,6 +104,7 @@ export class CreateKindClusterPage extends CreateClusterBasePage {
95104

96105
if (containerImage) {
97106
await fillTextbox(this.containerImage, containerImage);
107+
await playExpect(this.containerImage).toHaveText(containerImage);
98108
}
99109
await this.createCluster(timeout);
100110
});

tests/playwright/src/specs/deploy-to-kubernetes.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const CONTAINER_START_PARAMS: ContainerInteractiveParams = {
3939
};
4040

4141
const skipKindInstallation = process.env.SKIP_KIND_INSTALL === 'true';
42+
const providerTypeGHA = process.env.KIND_PROVIDER_GHA ?? '';
4243

4344
test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => {
4445
test.setTimeout(350_000);
@@ -54,7 +55,10 @@ test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => {
5455
}
5556

5657
if (process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux') {
57-
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, { useIngressController: false });
58+
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, {
59+
providerType: providerTypeGHA,
60+
useIngressController: false,
61+
});
5862
} else {
5963
await createKindCluster(page, CLUSTER_NAME, true, CLUSTER_CREATION_TIMEOUT);
6064
}

tests/playwright/src/specs/kind.spec.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ let resourcesPage: ResourcesPage;
4242
let kindResourceCard: ResourceConnectionCardPage;
4343

4444
const skipKindInstallation = process.env.SKIP_KIND_INSTALL === 'true';
45+
const providerTypeGHA = process.env.KIND_PROVIDER_GHA ?? '';
4546

4647
test.beforeAll(async ({ runner, page, welcomePage }) => {
4748
runner.setVideoAndTraceName('kind-e2e');
@@ -87,14 +88,13 @@ test.describe.serial('Kind End-to-End Tests', { tag: '@k8s_e2e' }, () => {
8788
});
8889
});
8990
test.describe('Kind cluster validation tests', () => {
90-
test.skip(
91-
!!process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux',
92-
'Tests suite should not run on Linux platform',
93-
);
9491
test('Create a Kind cluster', async ({ page }) => {
9592
test.setTimeout(CLUSTER_CREATION_TIMEOUT);
9693
if (process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux') {
97-
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, { useIngressController: false });
94+
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, {
95+
providerType: providerTypeGHA,
96+
useIngressController: false,
97+
});
9898
} else {
9999
await createKindCluster(page, CLUSTER_NAME, true, CLUSTER_CREATION_TIMEOUT);
100100
}
@@ -131,14 +131,13 @@ test.describe.serial('Kind End-to-End Tests', { tag: '@k8s_e2e' }, () => {
131131
});
132132
});
133133
test.describe('Kind cluster operations - Details', () => {
134-
test.skip(
135-
!!process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux',
136-
'Tests suite should not run on Linux platform',
137-
);
138134
test('Create a Kind cluster', async ({ page }) => {
139135
test.setTimeout(CLUSTER_CREATION_TIMEOUT);
140136
if (process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux') {
141-
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, { useIngressController: false });
137+
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, {
138+
providerType: providerTypeGHA,
139+
useIngressController: false,
140+
});
142141
} else {
143142
await createKindCluster(page, CLUSTER_NAME, true, CLUSTER_CREATION_TIMEOUT);
144143
}

tests/playwright/src/specs/kubernetes-edit-yaml.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const __dirname = path.dirname(__filename);
4646
const DEPLOYMENT_YAML_PATH = path.resolve(__dirname, '..', '..', 'resources', 'kubernetes', `${DEPLOYMENT_NAME}.yaml`);
4747

4848
const skipKindInstallation = process.env.SKIP_KIND_INSTALL === 'true';
49+
const providerTypeGHA = process.env.KIND_PROVIDER_GHA ?? '';
4950

5051
test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => {
5152
test.setTimeout(350_000);
@@ -61,7 +62,10 @@ test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => {
6162
}
6263

6364
if (process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux') {
64-
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, { useIngressController: false });
65+
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, {
66+
providerType: providerTypeGHA,
67+
useIngressController: false,
68+
});
6569
} else {
6670
await createKindCluster(page, CLUSTER_NAME, true, CLUSTER_CREATION_TIMEOUT);
6771
}

tests/playwright/src/specs/kubernetes.spec.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const SECRET_YAML_PATH = path.resolve(__dirname, '..', '..', 'resources', 'kuber
5353
const SECRET_POD_YAML_PATH = path.resolve(__dirname, '..', '..', 'resources', 'kubernetes', `${SECRET_POD_NAME}.yaml`);
5454

5555
const skipKindInstallation = process.env.SKIP_KIND_INSTALL === 'true';
56+
const providerTypeGHA = process.env.KIND_PROVIDER_GHA ?? '';
5657

5758
test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => {
5859
test.setTimeout(350_000);
@@ -68,7 +69,10 @@ test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => {
6869
}
6970

7071
if (process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux') {
71-
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, { useIngressController: false });
72+
await createKindCluster(page, CLUSTER_NAME, false, CLUSTER_CREATION_TIMEOUT, {
73+
providerType: providerTypeGHA,
74+
useIngressController: false,
75+
});
7276
} else {
7377
await createKindCluster(page, CLUSTER_NAME, true, CLUSTER_CREATION_TIMEOUT);
7478
}

0 commit comments

Comments
 (0)