-
Notifications
You must be signed in to change notification settings - Fork 4
111 lines (107 loc) · 4.18 KB
/
run-performance.yml
File metadata and controls
111 lines (107 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Run k6 performance test
on:
workflow_dispatch:
inputs:
apiVersion:
description: 'API Version'
required: true
default: 'v1'
environment:
description: 'Environment'
required: true
default: 'yt01'
type: choice
options:
- yt01
tag:
description: 'tag the performance test'
required: true
default: 'Performance test'
type: string
vus:
description: 'Number of VUS'
required: true
default: 1
type: number
duration:
description: 'Duration of test, ie 30s, 1m, 10m'
required: true
default: 1m
type: string
parallelism:
description: 'Number of parallel test runs'
required: true
default: 1
type: number
breakpoint:
description: 'Gradually raise the load to number of VUs over the duration of the test. If VUs is high, it will run until the system breaks'
required: true
default: false
type: boolean
abortOnFail:
description: 'Abort on fail. Only used for breakpoint tests'
required: true
default: false
type: boolean
testSuitePath:
description: 'Path to test suite to run'
required: true
default: 'test/Altinn.Platform.Authentication.PerformanceTests/createAndConfirmSystemUser.js'
type: choice
options:
- 'test/Altinn.Platform.Authentication.PerformanceTests/createAndConfirmSystemUser.js'
- 'test/Altinn.Platform.Authentication.PerformanceTests/createClientDelegations.js'
- 'test/Altinn.Platform.Authentication.PerformanceTests/getSystemUser.js'
- 'test/Altinn.Platform.Authentication.PerformanceTests/partiesQuery.js'
permissions:
id-token: write
contents: read
run-name: ${{ inputs.tag }} ${{ inputs.vus }}/${{ inputs.duration }}/${{ inputs.parallelism }}
jobs:
k6-performance:
runs-on: ubuntu-latest
environment: dev
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: OIDC Login to Azure Public Cloud
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 #v2
with:
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
allow-no-subscriptions: true
- name: Populate kubeconfig with k6 context
id: populate_kubeconfig_with_k6_context
shell: bash
run: |
if ! az aks install-cli; then
echo "Failed to install kubectl CLI"
exit 1
fi
if ! az aks get-credentials --resource-group k6tests-rg --name k6tests-cluster; then
echo "Failed to populate kubeconfig"
exit 1
fi
if ! kubelogin convert-kubeconfig -l azurecli; then
echo "Failed to convert kubeconfig"
exit 1
fi
- name: Setup k6
uses: grafana/setup-k6-action@ffe7d7290dfa715e48c2ccc924d068444c94bde2 # v1.1.0
- name: Run K6 tests (${{ inputs.testSuitePath }})
run: |
echo "Running k6 test suite ${{ inputs.testSuitePath }} with ${{ inputs.vus }} VUs for ${{ inputs.duration }} on ${{ inputs.parallelism }} parallelism"
k6configName=$(basename "${{ inputs.testSuitePath }}" .js)
k6configName="k6-${k6configName}"
./test/Altinn.Platform.Authentication.PerformanceTests/run-test-in-k8s.sh \
-f "${{ inputs.testSuitePath }}" \
-c "$k6configName" \
-n "$k6configName" \
-v "${{ inputs.vus }}" \
-d "${{ inputs.duration }}" \
-p "${{ inputs.parallelism }}" \
-a "${{ inputs.abortOnFail }}" \
-b "${{ inputs.breakpoint }}"
env:
API_ENVIRONMENT: ${{ inputs.environment }}
API_VERSION: ${{ inputs.apiVersion }}