-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa766c7
commit c73a46a
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: K6 Performance Tests | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
script: | ||
type: choice | ||
default: 'IdP_keys.js' | ||
options: | ||
- IdP_keys.js | ||
- All_IdP.js | ||
logLevel: | ||
description: 'Log level' | ||
required: true | ||
default: 'warning' | ||
type: choice | ||
options: | ||
- warning | ||
|
||
jobs: | ||
performance-tests: | ||
runs-on: ubuntu-latest | ||
env: | ||
K6_BROWSER_ENABLED: false | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup k6 | ||
uses: grafana/setup-k6-action@v1 | ||
|
||
- name: Run k6 test | ||
uses: grafana/run-k6-action@v1 | ||
with: | ||
path: | | ||
./src/${{ inputs.script }} | ||
- name: Upload Report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: k6-browser-report-summary | ||
path: TestSummaryReport.html | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import http from 'k6/http'; | ||
import { check, sleep } from 'k6'; | ||
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/2.4.0/dist/bundle.js"; | ||
|
||
export let options = { | ||
stages: [ | ||
{ duration: '5s', target: 1 }, // Simula 20 utenti per 30 secondi | ||
{ duration: '10s', target: 2 }, // Riduce a 10 utenti per 1 minuto | ||
{ duration: '3s', target: 1 }, // Riduce a 0 utenti in 10 secondi | ||
], | ||
}; | ||
|
||
export default function () { | ||
let res = http.get('https://dev.oneid.pagopa.it/idps'); | ||
check(res, { | ||
'status was 200': (r) => r.status == 200, | ||
'response time was less than 500ms': (r) => r.timings.duration < 5000, | ||
}); | ||
sleep(1); | ||
} | ||
|
||
export function handleSummary(data) { | ||
return { | ||
'TestSummaryReport.html': htmlReport(data, { debug: true }) | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import http from 'k6/http'; | ||
import { check, sleep } from 'k6'; | ||
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/2.4.0/dist/bundle.js"; | ||
|
||
export let options = { | ||
stages: [ | ||
{ duration: '5s', target: 10 }, // Simula 20 utenti per 30 secondi | ||
{ duration: '10s', target: 20 }, // Riduce a 10 utenti per 1 minuto | ||
{ duration: '3s', target: 10 }, // Riduce a 0 utenti in 10 secondi | ||
], | ||
}; | ||
|
||
export default function () { | ||
let res = http.get('https://api.is.eng.pagopa.it/idp-keys/spid/latest'); | ||
check(res, { | ||
'status was 200': (r) => r.status == 200, | ||
'response time was less than 500ms': (r) => r.timings.duration < 5000, | ||
}); | ||
sleep(1); | ||
} | ||
|
||
export function handleSummary(data) { | ||
return { | ||
'TestSummaryReport.html': htmlReport(data, { debug: true }) | ||
}; | ||
} |