Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3a66e0f
1st shot with claude
tumbledwyer Apr 14, 2026
653e017
Smoke test working locally with remote grafana
tumbledwyer Apr 15, 2026
638bded
add data generator image build
adskyiproger Apr 15, 2026
9e53bf9
refactored code
adskyiproger Apr 15, 2026
3303537
refactored code
adskyiproger Apr 15, 2026
ed794a5
add perf-test helm chart
adskyiproger Apr 15, 2026
3208ebb
polishing
adskyiproger Apr 15, 2026
f7fcae0
small fixes
adskyiproger Apr 16, 2026
84492e7
Add load test and parameter to choose test to run
tumbledwyer Apr 16, 2026
a90beb9
testing
adskyiproger Apr 20, 2026
6927228
fix: add elasticsearch output plugin
adskyiproger Apr 20, 2026
6f63cab
fix: add elasticsearch output plugin
adskyiproger Apr 20, 2026
649add5
Add soak test
tumbledwyer Apr 21, 2026
573be70
Remove references to k6 cloud since we're not using it
tumbledwyer Apr 21, 2026
aff3f3f
Add missing envs
tumbledwyer Apr 21, 2026
6f02c64
Export summary
tumbledwyer Apr 21, 2026
442d4d1
Remove colour to fix ansi characters in summary
tumbledwyer Apr 21, 2026
688b58c
run on very low value
adskyiproger Apr 23, 2026
2706706
Ramp up load test gradually
tumbledwyer Apr 23, 2026
37a383b
Triple thresholds to make test runs longer before failing
tumbledwyer Apr 23, 2026
52552e3
Add declaration to register action to fix errors
tumbledwyer Apr 24, 2026
f837307
Add spike test
tumbledwyer Apr 24, 2026
8109d80
Spread auth log by staggering and add error logging
tumbledwyer Apr 24, 2026
c09f0f5
Update tests to sleep before searching to get around elasticsearch re…
tumbledwyer Apr 30, 2026
8218dc1
Extract session logic
tumbledwyer Apr 30, 2026
4b26ade
Add user test
tumbledwyer Apr 30, 2026
aae1da4
Remove commented load test stages
tumbledwyer May 4, 2026
fb64e67
Change default user to match what is in the current seed data
tumbledwyer May 5, 2026
c38ca16
Fixed crypto reference error
tumbledwyer May 5, 2026
9559b40
Use custom uuid generator to solve difference between local and docker
tumbledwyer May 5, 2026
94082e5
Fix default user
tumbledwyer May 5, 2026
2363e38
Fix Bad Gateway handling
tumbledwyer May 5, 2026
bcc7db4
Fix senior-is hidden field with value error
tumbledwyer May 5, 2026
47ef1cb
Give user fetching its own thresholds
tumbledwyer May 5, 2026
43b4672
Quick temporary load test
tumbledwyer May 5, 2026
3e97b4a
Revert "Quick temporary load test"
tumbledwyer May 5, 2026
68c0492
Change soak test to 5 hours to fit in github action timeout
tumbledwyer May 6, 2026
021df99
Fix lint errors
tumbledwyer May 6, 2026
f69c133
Remove redundant comments
tumbledwyer May 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Push Perftest Image
name: Build and Push Images

on:
push:
Expand All @@ -8,12 +8,20 @@ on:
jobs:
build-and-push:
runs-on: ubuntu-24.04

name: ${{ matrix.image_name }}
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- image_name: opencrvs-data-generator
dockerfile: Dockerfile.data-generator
- image_name: opencrvs-perf-test
dockerfile: Dockerfile.perf-test
env:
image_path: ghcr.io/opencrvs/opencrvs-perftest-data-generator
image_path: ghcr.io/opencrvs/${{ matrix.image_name }}
steps:
- name: Checkout code
uses: actions/checkout@v6
Expand All @@ -35,7 +43,7 @@ jobs:
fi
- name: Build Docker image
run: |
docker build -t ${{ env.image_path }}:${{ env.image_tag }} -f Dockerfile .
docker build -t ${{ env.image_path }}:${{ env.image_tag }} -f ${{ matrix.dockerfile }} .

- name: Push Docker image
run: |
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
local-README.md
dist/
.env
File renamed without changes.
31 changes: 31 additions & 0 deletions Dockerfile.perf-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM node:22-slim AS base

RUN apt-get update && apt-get upgrade -y

RUN apt-get clean && \
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

WORKDIR /app

COPY --chown=node:node *.json .
COPY --chown=node:node yarn.lock .
COPY --chown=node:node build.mjs .
COPY --chown=node:node src ./src
COPY --chown=node:node tests ./tests
RUN yarn install && yarn build

# Build the k6 binary with the elasticsearch output extension
# See reference:
# https://grafana.com/docs/k6/latest/results-output/real-time/elasticsearch/
# https://hub.docker.com/r/grafana/xk6/
FROM grafana/xk6:latest AS k6-builder
WORKDIR /app
RUN xk6 build --with github.com/elastic/xk6-output-elasticsearch
RUN ls -la /app

# Final image with k6 and test script
FROM alpine:latest
WORKDIR /app
COPY --from=k6-builder /app/k6 /usr/bin/k6
COPY --from=base /app/dist /app
ENTRYPOINT ["/usr/bin/k6"]
26 changes: 26 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import esbuild from 'esbuild';
import { readdir } from 'fs/promises';

// Usage: node build.mjs [testName...]
// node build.mjs → builds all tests/*.ts
// node build.mjs smoke → builds tests/smoke.ts only
const names = process.argv.slice(2);

const entryPoints =
names.length > 0
? names.map((n) => `tests/${n}.ts`)
: (await readdir('tests'))
.filter((f) => f.endsWith('.ts'))
.map((f) => `tests/${f}`);

await esbuild.build({
entryPoints,
bundle: true,
platform: 'browser',
format: 'cjs',
target: 'es2015',
outdir: 'dist',
// k6 built-in modules must stay external — not bundled
external: ['k6', 'k6/*', 'https://jslib.k6.io/*'],
logLevel: 'info',
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: performance-test
name: data-generator
description: Run a one-off job to generate performance test data
type: application
version: 0.1.0
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "perf-test-generator.fullname" . }}-{{ .Release.Revision }}
labels:
app.kubernetes.io/name: {{ include "perf-test-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
backoffLimit: {{ .Values.job.backoffLimit }}
ttlSecondsAfterFinished: {{ .Values.job.ttlSecondsAfterFinished }}
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions charts/perf-test/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: perf-test
description: Run a one-off performance test job
type: application
version: 0.1.0
appVersion: "1.0.0"
47 changes: 47 additions & 0 deletions charts/perf-test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# General informaiton

Goal of this helm chart is to provide developer and tester a way to run performance data generator on remote server.

Helm chart creates one time kubernetes job to generate data.

# Values

Create you own `values.yaml` using values.yaml as reference.


# Install/Upgrade from your laptop

Example of custom perf-test.yaml file**

```yaml
env:
GATEWAY_URL: https://gateway.tmp-prod.opencrvs.dev
EVENTS_URL: https://events.tmp-prod.opencrvs.dev

```


**Install/upgrade command**

```
helm upgrade \
--install \
-f perf-test.yaml \
perf-test-job chart/perf-test/
```


# Install/Upgrade from GitHub Actions workflow

Please create all required secrets/variables before adding this code snipped to GitHub actions

```
helm upgrade \
--install \
--set env.GATEWAY_URL=https://gateway.${{ vars.domain }} \
--set env.EVENTS_URL=https://events.${{ vars.domain }} \
--set postgres.user=${{ secrets.POSTGRES_USER }} \
--set postgres.password=${{ secrets.POSTGRES_PASSWORD }} \
--set postgres.host=${{ vars.POSTGRES_HOSTNAME }} \
perf-test-job oci://ghcr.io/opencrvs/perf-test:0.1.0
```
11 changes: 11 additions & 0 deletions charts/perf-test/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- define "perf-test-generator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "perf-test-generator.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name (include "perf-test-generator.name" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
75 changes: 75 additions & 0 deletions charts/perf-test/templates/perf-test-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "perf-test-generator.fullname" . }}-{{ .Release.Revision }}
labels:
app.kubernetes.io/name: {{ include "perf-test-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
backoffLimit: {{ .Values.job.backoffLimit }}
ttlSecondsAfterFinished: {{ .Values.job.ttlSecondsAfterFinished }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "perf-test-generator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
restartPolicy: Never
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: generator
command:
{{- if .Values.command }}
{{- toYaml .Values.command | nindent 10 }}
{{- else }}
["k6"]
{{- end }}
args:
{{- if .Values.command }}
{{- toYaml .Values.command | nindent 10 }}
{{- else }}
- run
- /app/{{ .Values.k6_script }}.js
{{- if .Values.k6_output }}
- --out
- {{ .Values.k6_output }}
{{- end }}
{{- range $k, $v := .Values.k6_env_args }}
- -e
- {{ $k }}={{ $v }}
{{- end }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- range $k, $v := .Values.env }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- end }}
{{- range $secretName, $mappings := .Values.perf_test.secrets }}
{{- range $mappings }}
{{- $parts := splitList ":" . }}
- name: {{ index $parts 1 }}
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: {{ index $parts 0 }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
27 changes: 27 additions & 0 deletions charts/perf-test/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
image:
repository: ghcr.io/opencrvs/opencrvs-perf-test
tag: latest
pullPolicy: Always

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

job:
backoffLimit: 0
ttlSecondsAfterFinished: 3600

resources: {}

nodeSelector: {}
tolerations: []
affinity: {}

# Optional: override command/args if your image does not already have the right entrypoint
command: []
args: []

k6_script: "smoke"

k6_env_args:
GATEWAY_URL: "http://opencrvs-gateway:3000"
Loading
Loading