Skip to content

Commit 55fcd90

Browse files
committed
improve tests
1 parent b06c739 commit 55fcd90

File tree

6 files changed

+38
-50
lines changed

6 files changed

+38
-50
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
# This script returns the id of the draft release
4+
5+
# standard bash error handling
6+
set -o nounset # treat unset variables as an error and exit immediately.
7+
set -o errexit # exit immediately when a command fails.
8+
set -E # needs to be set if we want the ERR trap
9+
set -o pipefail # prevents errors in a pipeline from being masked
10+
11+
npm ci
12+
npm run build
13+
cp -r build backend/core-ui
14+
cd backend
15+
npm run build
16+
IS_DOCKER=true npm run start:prod > busola.log &
17+
export DOMAIN=http://localhost:3001
18+
echo "waiting for server to be up..."
19+
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$DOMAIN")" != "200" ]]; do sleep 5; done

.github/workflows/pull-integration-cluster-k3d.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: PR Integration Cluster Tests
22

3-
on:
3+
on:
44
pull_request:
5-
types: [opened, edited, synchronize, reopened, ready_for_review]
5+
types: [ opened, edited, synchronize, reopened, ready_for_review ]
66
paths:
77
- ".github/workflows/pull-integration-cluster-k3d.yml"
88
- "resources/**"
@@ -39,26 +39,15 @@ jobs:
3939
- uses: actions/setup-node@v4
4040
with:
4141
node-version: 20
42-
- name: setup_busola
42+
- name: Setup Busola
4343
shell: bash
4444
run: |
45-
set -e
46-
npm ci
47-
npm run build
48-
cp -r build backend/core-ui
49-
cd backend
50-
npm run build
51-
IS_DOCKER=true npm run start:prod > busola.log &
45+
.github/scripts/setup-local_busola.sh
5246
- name: run_tests
5347
shell: bash
5448
run: |
5549
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
56-
export CYPRESS_DOMAIN=http://localhost:3001
57-
58-
echo "waiting for server to be up..."
59-
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done
60-
sleep 10
61-
50+
export CYPRESS_DOMAIN=http://localhost:3001
6251
cd tests/integration
6352
npm ci && npm run "test:cluster"
6453
- name: Uploads artifacts

.github/workflows/pull-integration-namespace-k3d.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,15 @@ jobs:
3939
- uses: actions/setup-node@v4
4040
with:
4141
node-version: 20
42-
- name: setup_busola
42+
- name: Setup Busola
4343
shell: bash
4444
run: |
45-
set -e
46-
npm ci
47-
npm run build
48-
cp -r build backend/core-ui
49-
cd backend
50-
npm run build
51-
IS_DOCKER=true npm run start:prod > busola.log &
52-
- name: run_tests
45+
.github/scripts/setup-local_busola.sh
46+
- name: Run tests
5347
shell: bash
5448
run: |
55-
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
5649
export CYPRESS_DOMAIN=http://localhost:3001
57-
58-
echo "waiting for server to be up..."
59-
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$CYPRESS_DOMAIN")" != "200" ]]; do sleep 5; done
60-
sleep 10
61-
50+
k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml
6251
cd tests/integration
6352
npm ci && npm run "test:namespace"
6453
- name: Uploads artifacts

.github/workflows/pull-kyma-integration-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232
- uses: actions/setup-node@v4
3333
with:
3434
node-version: 20
35-
- name: setup_busola
35+
- name: Setup Busola
3636
shell: bash
3737
run: |
38-
./.github/scripts/setup-busola.sh | tee busola-build.log
38+
.github/scripts/setup-local_busola.sh
3939
env:
4040
ENV: dev
41-
- name: run_tests
41+
- name: Run tests
4242
shell: bash
4343
run: |
4444
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml

.github/workflows/pull-lighthouse.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,14 @@ jobs:
3232
- uses: actions/setup-node@v4
3333
with:
3434
node-version: 20
35-
- name: setup_busola
35+
- name: Run busola
3636
shell: bash
3737
run: |
38-
set -e
39-
npm ci
40-
npm run build
41-
cp -r build backend/core-ui
42-
cd backend
43-
npm run build
44-
IS_DOCKER=true npm run start:prod > busola.log &
45-
- name: run_tests
38+
.github/scripts/setup-local_busola.sh
39+
- name: Run lighthouse tests
4640
shell: bash
4741
run: |
4842
k3d kubeconfig get k3dCluster > tests/lighthouse/fixtures/kubeconfig.yaml
49-
export DOMAIN=http://localhost:3001
50-
51-
echo "waiting for server to be up..."
52-
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' "$DOMAIN")" != "200" ]]; do sleep 5; done
53-
sleep 10
54-
5543
cd tests/lighthouse
5644
npm ci && npx playwright install --with-deps && npm run "test"
5745
- name: Upload Busola logs

tests/lighthouse/lighthouse.spec.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { playAudit } from 'playwright-lighthouse';
33
import { chromium } from 'playwright';
44
import { tmpdir } from 'os';
55

6-
const ADDRESS = 'http://localhost:3001';
6+
const ADDRESS = process.env.LOCAL
7+
? 'http://localhost:8080'
8+
: 'http://localhost:3001';
9+
// What to do with that
710

811
test('Busola Lighthouse audit', async () => {
912
const context = await chromium.launchPersistentContext(tmpdir(), {

0 commit comments

Comments
 (0)