Skip to content

Commit ccc871d

Browse files
ci: workflow: add helm e2e tests for plugin manager
1 parent 10316ab commit ccc871d

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

.github/workflows/build-container.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,38 @@ jobs:
302302
echo "❌ In-cluster API tests failed with exit code $EXIT_CODE"
303303
exit $EXIT_CODE
304304
fi
305+
- name: Set up Helm
306+
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab # v1.1
307+
with:
308+
version: v3.7.0
309+
- name: Deploy Headlamp via Helm and run plugin manager tests
310+
run: |
311+
kubectl config use-context test
312+
kubectl create namespace headlamp-helm
313+
echo 'image:' > helm-values.yaml
314+
echo ' registry: ghcr.io' >> helm-values.yaml
315+
echo ' repository: headlamp-k8s/headlamp' >> helm-values.yaml
316+
echo ' tag: latest' >> helm-values.yaml
317+
echo ' pullPolicy: Never' >> helm-values.yaml
318+
echo 'config:' >> helm-values.yaml
319+
echo ' baseURL: "/headlamp-helm"' >> helm-values.yaml
320+
echo 'service:' >> helm-values.yaml
321+
echo ' type: NodePort' >> helm-values.yaml
322+
echo 'pluginsManager:' >> helm-values.yaml
323+
echo ' enabled: true' >> helm-values.yaml
324+
echo ' configContent: |' >> helm-values.yaml
325+
echo ' plugins:' >> helm-values.yaml
326+
echo ' - name: flux' >> helm-values.yaml
327+
echo ' source: https://artifacthub.io/packages/headlamp/headlamp-k8s/flux' >> helm-values.yaml
328+
helm install headlamp ./charts/headlamp --namespace headlamp-helm -f helm-values.yaml
329+
echo "Waiting for headlamp helm deployment to be available..."
330+
kubectl wait deployment -n headlamp-helm headlamp --for condition=Available=True --timeout=120s
331+
IP_ADDRESS=$(kubectl get nodes --context test -o=jsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
332+
SERVICE_PORT=$(kubectl get services headlamp -n headlamp-helm -o=jsonpath='{.spec.ports[0].nodePort}')
333+
export SERVICE_URL="http://${IP_ADDRESS}:${SERVICE_PORT}/headlamp-helm"
334+
echo "Helm Headlamp URL: $SERVICE_URL"
335+
cd e2e-tests
336+
HEADLAMP_TEST_URL=$SERVICE_URL npx playwright test tests/helmPlugins.spec.ts
305337
# Clear disk space by removing unnecessary files, apt files and uninstall some playwright dependencies
306338
- name: Clear Disk Space
307339
if: steps.cache-image-restore2.outputs.cache-hit != 'true'

e2e-tests/tests/headlampPage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ export class HeadlampPage {
139139
}
140140
}
141141

142+
async tableContains(text: string, options?: { timeout?: number }) {
143+
await expect(this.page.locator('table')).toContainText(text, options);
144+
}
145+
142146
async clickOnPlugin(pluginName: string) {
143147
await this.page.click(`a:has-text("${pluginName}")`);
144148
await this.page.waitForLoadState('load');
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2025 The Kubernetes Authors
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+
17+
/// <reference types="node" />
18+
import {test } from '@playwright/test';
19+
import { HeadlampPage } from './headlampPage';
20+
21+
let headlampPage: HeadlampPage;
22+
23+
test.beforeEach(async ({ page }) => {
24+
headlampPage = new HeadlampPage(page);
25+
26+
await headlampPage.navigateToCluster('main', process.env.HEADLAMP_TEST_TOKEN);
27+
});
28+
29+
test('plugin manager should have installed plugins via helm', async () => {
30+
// Wait for plugins to be loaded.
31+
// The plugin we are installing is 'headlamp-pod-counter' via Helm.
32+
33+
await headlampPage.navigateTopage('/settings/plugins', /Plugins/);
34+
35+
// Check if the plugin is in the list.
36+
// It might take some time for the plugin manager to install it.
37+
await headlampPage.tableContains('Flux', { timeout: 60000 });
38+
});

0 commit comments

Comments
 (0)