Skip to content

Commit 4912a21

Browse files
authored
Chore: test exec speedup (#267)
* chore: no sync for backend/unit tests (eleminates useless downloads of libs from dev group) * chore: e2e-ready with parallel actions via crictl * chore: mypy test group deps added * chore: frontend/unit update * chore: frontend/unit mock centralization * chore: removed jsdom + useless comments
1 parent 666d9e1 commit 4912a21

48 files changed

Lines changed: 1042 additions & 1224 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/e2e-boot/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,27 @@ runs:
4141
echo "$K3S_INSTALL_SHA256 /tmp/k3s-install.sh" | sha256sum -c -
4242
chmod +x /tmp/k3s-install.sh
4343
INSTALL_K3S_VERSION="$K3S_VERSION" INSTALL_K3S_EXEC="--disable=traefik --bind-address 0.0.0.0 --tls-san host.docker.internal" /tmp/k3s-install.sh
44+
45+
- name: Pre-pull executor images and Kueue manifest (background)
46+
shell: bash
47+
run: |
48+
KUEUE_VERSION="${KUEUE_VERSION:-v0.16.1}"
49+
50+
nohup bash -c '
51+
curl -fsSL -o /tmp/kueue-manifests.yaml \
52+
"https://github.com/kubernetes-sigs/kueue/releases/download/'"$KUEUE_VERSION"'/manifests.yaml"
53+
echo $? > /tmp/kueue-download.exit
54+
' > /tmp/kueue-download.log 2>&1 &
55+
echo $! > /tmp/kueue-download.pid
56+
57+
nohup bash -c '
58+
sudo k3s crictl pull docker.io/library/python:3.11-slim
59+
echo $? > /tmp/crictl-python.exit
60+
' > /tmp/crictl-python.log 2>&1 &
61+
echo $! > /tmp/crictl-python.pid
62+
63+
nohup bash -c '
64+
sudo k3s crictl pull docker.io/library/busybox:1.36
65+
echo $? > /tmp/crictl-busybox.exit
66+
' > /tmp/crictl-busybox.log 2>&1 &
67+
echo $! > /tmp/crictl-busybox.pid

.github/actions/e2e-ready/action.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: 'Also wait for frontend health check (default: false)'
1010
required: false
1111
default: 'false'
12+
install-kueue:
13+
description: 'Install Kueue CRDs for executor pods (default: true)'
14+
required: false
15+
default: 'true'
1216

1317
runs:
1418
using: 'composite'
@@ -26,18 +30,26 @@ runs:
2630
/home/runner/.kube/config > backend/kubeconfig.yaml
2731
chmod 644 backend/kubeconfig.yaml
2832
29-
- name: Install Kueue
33+
- name: Install Kueue and wait for executor image pulls
34+
if: inputs.install-kueue == 'true'
3035
shell: bash
3136
run: |
37+
set -e
38+
3239
KUEUE_VERSION="${KUEUE_VERSION:-v0.16.1}"
3340
KUEUE_MANIFEST_SHA256="${KUEUE_MANIFEST_SHA256:-3201a66ff731be440ecfcf3c0fa5979d001b834f68389208fe7ee18017fbcfe8}"
3441
KUEUE_MANIFEST="/tmp/kueue-manifests.yaml"
35-
curl -fsSL -o "$KUEUE_MANIFEST" "https://github.com/kubernetes-sigs/kueue/releases/download/${KUEUE_VERSION}/manifests.yaml"
42+
43+
timeout 120 tail --pid="$(cat /tmp/kueue-download.pid)" -f /dev/null 2>/dev/null || true
44+
cat /tmp/kueue-download.log 2>/dev/null || true
45+
[ "$(cat /tmp/kueue-download.exit)" = "0" ]
46+
3647
echo "${KUEUE_MANIFEST_SHA256} ${KUEUE_MANIFEST}" | sha256sum -c -
3748
kubectl apply --server-side -f "$KUEUE_MANIFEST"
3849
rm -f "$KUEUE_MANIFEST"
3950
kubectl wait --for=condition=Available --timeout=120s \
4051
deployment/kueue-controller-manager -n kueue-system
52+
4153
kubectl apply --server-side -f - <<'EOF'
4254
apiVersion: kueue.x-k8s.io/v1beta1
4355
kind: ResourceFlavor
@@ -69,34 +81,23 @@ runs:
6981
clusterQueue: executor-queue
7082
EOF
7183
72-
- name: Use test environment config
73-
shell: bash
74-
run: cp backend/config.test.toml backend/config.toml
84+
timeout 120 tail --pid="$(cat /tmp/crictl-python.pid)" -f /dev/null 2>/dev/null || true
85+
cat /tmp/crictl-python.log 2>/dev/null || true
86+
[ "$(cat /tmp/crictl-python.exit)" = "0" ]
7587
76-
- name: Pre-pull test runtime images into K3s
77-
shell: bash
78-
run: |
79-
sudo k3s crictl pull docker.io/library/python:3.11-slim
80-
sudo k3s crictl pull docker.io/library/busybox:1.36
88+
timeout 120 tail --pid="$(cat /tmp/crictl-busybox.pid)" -f /dev/null 2>/dev/null || true
89+
cat /tmp/crictl-busybox.log 2>/dev/null || true
90+
[ "$(cat /tmp/crictl-busybox.exit)" = "0" ]
8191
82-
- name: Wait for image pull and infra
92+
- name: Prepare config, wait for infra
8393
shell: bash
8494
run: |
85-
if [ -f /tmp/infra-pull.pid ]; then
86-
PID=$(cat /tmp/infra-pull.pid)
87-
if kill -0 "$PID" 2>/dev/null; then
88-
echo "Waiting for image pull + infra startup..."
89-
tail --pid="$PID" -f /dev/null 2>/dev/null || true
90-
fi
91-
fi
95+
set -e
96+
cp backend/config.test.toml backend/config.toml
97+
98+
timeout 120 tail --pid="$(cat /tmp/infra-pull.pid)" -f /dev/null 2>/dev/null || true
9299
cat /tmp/infra-pull.log 2>/dev/null || true
93-
if [ -f /tmp/infra-pull.exit ]; then
94-
EXIT_CODE=$(cat /tmp/infra-pull.exit)
95-
if [ "$EXIT_CODE" != "0" ]; then
96-
echo "::error::Background image pull / infra pre-warm failed (exit $EXIT_CODE)"
97-
exit 1
98-
fi
99-
fi
100+
[ "$(cat /tmp/infra-pull.exit)" = "0" ]
100101
101102
- name: Start stack
102103
shell: bash
@@ -110,11 +111,10 @@ runs:
110111
WAIT_FOR_FRONTEND: ${{ inputs.wait-for-frontend }}
111112
run: |
112113
echo "Waiting for backend health..."
113-
timeout 120 bash -c 'until curl -ksf https://localhost/api/v1/health/live 2>/dev/null; do sleep 2; done'
114+
timeout 120 bash -c 'until curl -ksf https://localhost/api/v1/health/live 2>/dev/null; do sleep 1; done'
114115
echo "Backend ready"
115116
if [ "$WAIT_FOR_FRONTEND" = "true" ]; then
116117
echo "Waiting for frontend health..."
117-
timeout 60 bash -c 'until curl -ksf https://localhost:5001 2>/dev/null; do sleep 2; done'
118+
timeout 60 bash -c 'until curl -ksf https://localhost:5001 2>/dev/null; do sleep 1; done'
118119
echo "Frontend ready"
119120
fi
120-

.github/workflows/grimp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
- name: Run grimp orphan module check
3030
run: |
3131
cd backend
32-
uv run python scripts/check_orphan_modules.py
32+
uv run --no-sync python scripts/check_orphan_modules.py

.github/workflows/mypy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
run: |
2525
cd backend
2626
uv python install 3.12
27-
uv sync --frozen --group lint --no-dev
27+
uv sync --frozen --group lint --group test --no-dev
2828
2929
- name: Run mypy
3030
env:
3131
SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }}
3232
run: |
3333
cd backend
34-
uv run mypy --config-file pyproject.toml --strict .
34+
uv run --no-sync mypy --config-file pyproject.toml --strict .

.github/workflows/ruff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
- name: Run ruff
3030
run: |
3131
cd backend
32-
uv run ruff check . --config pyproject.toml
32+
uv run --no-sync ruff check . --config pyproject.toml

.github/workflows/stack-tests.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
timeout-minutes: 5
5959
run: |
6060
cd backend
61-
uv run pytest tests/unit -v -rs \
61+
uv run --no-sync pytest tests/unit -v -rs \
6262
--durations=0 \
6363
--cov=app \
6464
--cov-report=xml --cov-report=term
@@ -236,12 +236,14 @@ jobs:
236236
steps:
237237
- uses: actions/checkout@v6
238238

239-
- uses: ./.github/actions/e2e-boot
239+
- name: Boot E2E environment
240+
uses: ./.github/actions/e2e-boot
240241
with:
241242
image-tag: ${{ needs.build-images.outputs.sha-tag }}
242243
github-token: ${{ secrets.GITHUB_TOKEN }}
243244

244-
- uses: ./.github/actions/e2e-ready
245+
- name: Finalize k3s & start stack
246+
uses: ./.github/actions/e2e-ready
245247
with:
246248
image-tag: ${{ needs.build-images.outputs.sha-tag }}
247249

@@ -305,7 +307,8 @@ jobs:
305307
- uses: actions/checkout@v6
306308

307309
# Phase 1: kick off image pull + infra + k3s in background
308-
- uses: ./.github/actions/e2e-boot
310+
- name: Boot E2E environment
311+
uses: ./.github/actions/e2e-boot
309312
with:
310313
image-tag: ${{ needs.build-images.outputs.sha-tag }}
311314
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -339,10 +342,12 @@ jobs:
339342
run: npx playwright install chromium
340343

341344
# Phase 3: finalize k3s + start stack (k3s has been booting since e2e-boot)
342-
- uses: ./.github/actions/e2e-ready
345+
- name: Finalize k3s & start stack
346+
uses: ./.github/actions/e2e-ready
343347
with:
344348
image-tag: ${{ needs.build-images.outputs.sha-tag }}
345349
wait-for-frontend: 'true'
350+
install-kueue: 'false'
346351

347352
- name: Run Playwright tests
348353
timeout-minutes: 10

0 commit comments

Comments
 (0)