-
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.
Co-authored-by: LuciaM1 <[email protected]> Co-authored-by: GitHub Action <[email protected]> Co-authored-by: Lucia Mazzocchi <[email protected]> Co-authored-by: EmVal <[email protected]> Co-authored-by: Escarsel <[email protected]> Co-authored-by: USERSAD\evalenti <[email protected]> Co-authored-by: Elis Kina <[email protected]> Co-authored-by: GabrieleMaiocchiFilippo <[email protected]>
- Loading branch information
1 parent
5aa38fa
commit aaf4ec1
Showing
15 changed files
with
15,312 additions
and
14,975 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,34 @@ | ||
name: Manual run performance test | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
manual-create-pre-release: | ||
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/dev' | ||
strategy: | ||
matrix: | ||
environment: [dev] | ||
|
||
name: "manual-run-performance-test" | ||
runs-on: ubuntu-latest | ||
environment: ${{ matrix.environment }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run k6 local test | ||
uses: grafana/[email protected] | ||
env: | ||
MODEL_APPLICATION_BASE_URL: ${{ vars.MODEL_APPLICATION_BASE_URL }} | ||
MODEL_APPLICATION_BASE_PATH: ${{ vars.MODEL_APPLICATION_BASE_PATH }} | ||
MODEL_APPLICATION_KEY: ${{ secrets.MODEL_APPLICATION_KEY }} | ||
with: | ||
filename: perfomance_test/run_performance_tests.js |
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
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 @@ | ||
import http from 'k6/http'; | ||
import { group, check } from 'k6'; | ||
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js'; | ||
import { generateAssociationBody, generateUpgradedBpmnByDefKey } from '../../utils_functions.js'; | ||
import { deployBpmn } from './BPMN_deploy.js'; | ||
import { upgradeBpmn } from './BPMN_upgrade.js'; | ||
|
||
export function associateRouteBpmn(baseUrl, token, acquirerId, tagName, version) { | ||
group(tagName, function () { | ||
|
||
const deployedBpmn = JSON.parse(deployBpmn(baseUrl, token, 'BPMNdeploy', version)); | ||
upgradeBpmn( | ||
deployedBpmn.bpmnId, | ||
generateUpgradedBpmnByDefKey(deployedBpmn.definitionKey), | ||
token, | ||
baseUrl, | ||
'BPMNupgrade' | ||
); | ||
|
||
const fd = new FormData(); | ||
|
||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json; boundary=' + fd.boundary, | ||
'x-api-key': token, | ||
}, | ||
tags: { name: tagName } | ||
}; | ||
|
||
const endPoint = '/bpmn/bank/' + acquirerId + '/associations/function/MENU'; | ||
const url = baseUrl + endPoint; | ||
|
||
const response = http.put(url, generateAssociationBody(deployedBpmn.bpmnId), params); | ||
|
||
// console.error(); | ||
// console.log('Response status ASSOCIATE:', response.request); | ||
// console.log('Response status ASSOCIATE:', response.status); | ||
// console.log('Response body ASSOCIATE:', response.body); | ||
|
||
check(response, { | ||
'response code was 200': (response) => response.status == 200, | ||
}); | ||
}) | ||
} |
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,28 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js'; | ||
|
||
export function createBpmn(baseUrl, token, fileBpmn) { | ||
const fd = new FormData(); | ||
fd.append('filename', 'performance_test'); | ||
fd.append('file', fileBpmn); | ||
fd.append('functionType', 'MENU'); | ||
|
||
const headers = { | ||
'Content-Type': 'multipart/form-data; boundary=' + fd.boundary, | ||
'x-api-key': token, | ||
}; | ||
|
||
const params = { | ||
headers: headers, | ||
tags: { name: 'BPMNcreate' } | ||
}; | ||
|
||
const response = http.post(`${baseUrl}/bpmn`, fd.body(), params); | ||
|
||
check(response, { | ||
'response code was 200': (response) => response.status == 200 | ||
}); | ||
|
||
return typeof response !== 'undefined' ? response.body : {}; | ||
} |
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,34 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js'; | ||
import { createBpmnAndGetId } from '../../utils_functions.js'; | ||
|
||
export function deployBpmn(baseUrl, token, tagName, version) { | ||
|
||
const newBpmnBody = createBpmnAndGetId(baseUrl, token); | ||
const fd = new FormData(); | ||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json; boundary=' + fd.boundary, | ||
'x-api-key': token, | ||
}, | ||
tags: { name: tagName } | ||
}; | ||
|
||
const endPoint = '/bpmn/deploy/' + newBpmnBody.bpmnId + '/version/' + version; | ||
const url = baseUrl + endPoint; | ||
|
||
const response = http.post(url, fd.body(), params); | ||
|
||
// console.error(); | ||
// console.log('Response status DEPLOY:', response.request); | ||
// console.log('Response status DEPLOY:', response.status); | ||
// console.log('Response body DEPLOY:', response.body); | ||
|
||
check(response, { | ||
'response code was 200': (response) => response.status == 200, | ||
}); | ||
|
||
return typeof response !== 'undefined' ? response.body : {}; | ||
|
||
} |
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,23 @@ | ||
import http from 'k6/http'; | ||
import { group, check } from 'k6'; | ||
|
||
|
||
export function getAllBpmn(baseUrl, token) { | ||
group('BPMNgetAll', function () { | ||
|
||
const params = { | ||
headers: { | ||
'x-api-key': token, | ||
}, | ||
tags: { name: 'BPMNgetAll' }, | ||
}; | ||
|
||
let res = http.get(`${baseUrl}/api/v1/model/bpmn`, params); | ||
|
||
console.log(`Get All BPMN request duration: ${res.timings.duration} ms`); | ||
|
||
check(res, { | ||
'response code was 200': (res) => res.status == 200, | ||
}); | ||
}); | ||
} |
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,34 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js'; | ||
|
||
export function upgradeBpmn(uuid, fileBpmn, token, baseUrl, tagName) { | ||
const fd = new FormData(); | ||
fd.append('uuid', uuid); | ||
fd.append('filename', 'performance_test'); | ||
fd.append('file', fileBpmn); | ||
fd.append('functionType', 'MENU'); | ||
|
||
const headers = { | ||
'Content-Type': 'multipart/form-data; boundary=' + fd.boundary, | ||
'x-api-key': token, | ||
}; | ||
|
||
const endPoint = '/bpmn/upgrade'; | ||
const url = baseUrl + endPoint; | ||
|
||
const params = { | ||
headers: headers, | ||
tags: { name: tagName } | ||
} | ||
|
||
const response = http.post(url,fd.body(), params); | ||
|
||
// console.log('Response status UPGRADE:', response.request); | ||
// console.log('Response status UPGRADE:', response.status); | ||
// console.log('Response body UPGRADE:', response.body); | ||
|
||
check(response, { | ||
'response code was 200': (response) => response.status == 200 | ||
}); | ||
} |
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,32 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js'; | ||
import { generateRandomHTML, generatedHTMLResource } from '../../utils_functions.js'; | ||
|
||
export function updateHtmlResource(baseUrl, token) { | ||
const fd = new FormData(); | ||
const resourceId = generatedHTMLResource(baseUrl, token).resourceId; | ||
|
||
fd.append('file', generateRandomHTML()); | ||
|
||
const headers = { | ||
'Content-Type': 'multipart/form-data; boundary=' + fd.boundary, | ||
'x-api-key': token, | ||
}; | ||
|
||
const params = { | ||
headers: headers, | ||
tags: { name: 'RESOURCEUpdate' } | ||
}; | ||
|
||
const response = http.put(`${baseUrl}/resources/${resourceId}`, fd.body(), params); | ||
|
||
// console.error(); | ||
// console.log('Response request Resource UPDATE:', response.request); | ||
// console.log('Response status Resource UPDATE:', response.status); | ||
// console.log('Response body Resource UPDATE:', response.body); | ||
|
||
check(response, { | ||
'response code was 200': (response) => response.status == 200 | ||
}); | ||
} |
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,36 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { FormData } from 'https://jslib.k6.io/formdata/0.0.2/index.js'; | ||
|
||
export function createHtmlResource(baseUrl, token, file) { | ||
const fd = new FormData(); | ||
fd.append('filename', `performance_test_${new Date().getTime()}.html`); | ||
fd.append('file', file); | ||
fd.append('resourceType', 'HTML'); | ||
fd.append('path', 'performanceTest') | ||
|
||
const headers = { | ||
'Content-Type': 'multipart/form-data; boundary=' + fd.boundary, | ||
'x-api-key': token, | ||
}; | ||
|
||
const params = { | ||
headers: headers, | ||
tags: { name: 'RESOURCECreate' } | ||
}; | ||
|
||
const response = http.post(`${baseUrl}/resources`, fd.body(), params); | ||
|
||
// console.error(); | ||
// console.log('Response request Resource CREATE:', response.request); | ||
// console.log('Response status Resource CREATE:', response.status); | ||
// console.log('Response body Resource CREATE:', response.body); | ||
|
||
check(response, { | ||
'response code was 200': (response) => response.status == 200 | ||
}); | ||
|
||
|
||
|
||
return typeof response !== 'undefined' ? response.body : {}; | ||
} |
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,61 @@ | ||
export const thresholdsSettings = { | ||
http_req_failed: [{ threshold: 'rate<0.01', abortOnFail: true }], | ||
http_req_duration: ['p(99)<2000'], | ||
}; | ||
|
||
export const nameThresholds={ | ||
'http_req_duration{name:BPMNcreate}': ['p(95)<500'], | ||
'http_req_waiting{name:BPMNcreate}':['p(95)<200'], | ||
'http_req_failed{name:BPMNcreate}':['rate<0.01'], | ||
'http_reqs{name:BPMNcreate}':[], | ||
|
||
'http_req_duration{name:BPMNgetAll}': ['p(95)<6000'], | ||
'http_req_waiting{name:BPMNgetAll}':['p(95)<6000'], | ||
'http_req_failed{name:BPMNgetAll}':['rate<0.01'], | ||
'http_reqs{name:BPMNgetAll}':[], | ||
|
||
'http_req_duration{name:BPMNdeploy}': ['p(95)<1500'], | ||
'http_req_waiting{name:BPMNdeploy}':['p(95)<300'], | ||
'http_req_failed{name:BPMNdeploy}':['rate<0.01'], | ||
'http_reqs{name:BPMNdeploy}':[], | ||
|
||
'http_req_duration{name:BPMNassociate}': ['p(95)<1500'], | ||
'http_req_waiting{name:BPMNassociate}':['p(95)<00'], | ||
'http_req_failed{name:BPMNassociate}':['rate<0.01'], | ||
'http_reqs{name:BPMNassociate}':[], | ||
|
||
'http_req_duration{name:BPMNupgrade}': ['p(95)<1500'], | ||
'http_req_waiting{name:BPMNupgrade}':['p(95)<00'], | ||
'http_req_failed{name:BPMNupgrade}':['rate<0.01'], | ||
'http_reqs{name:BPMNupgrade}':[], | ||
|
||
// RESOURCES | ||
|
||
'http_req_duration{name:RESOURCECreate}': ['p(95)<1500'], | ||
'http_req_waiting{name:RESOURCECreate}':['p(95)<00'], | ||
'http_req_failed{name:RESOURCECreate}':['rate<0.01'], | ||
'http_reqs{name:RESOURCECreate}':[], | ||
|
||
'http_req_duration{name:RESOURCEUpdate}': ['p(95)<1500'], | ||
'http_req_waiting{name:RESOURCEUpdate}':['p(95)<00'], | ||
'http_req_failed{name:RESOURCEUpdate}':['rate<0.01'], | ||
'http_reqs{name:RESOURCEUpdate}':[] | ||
} | ||
|
||
|
||
export const average_load = { | ||
executor: 'ramping-vus', | ||
stages: [ | ||
{ duration: '2s', target: 20 }, | ||
{ duration: '5s', target: 20 }, | ||
{ duration: '5s', target: 0 }, | ||
], | ||
}; | ||
|
||
export const low_load = { | ||
executor: 'ramping-vus', | ||
stages: [ | ||
{ duration: '4s', target: 1 }, | ||
{ duration: '4s', target: 0 }, | ||
], | ||
}; |
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,28 @@ | ||
import { nameThresholds, low_load } from "./options_settings.js"; | ||
import { getAllBpmn } from "./functions/Bpmn/BPMN_getAll.js"; | ||
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js"; | ||
import { associateRouteBpmn } from "./functions/Bpmn/BPMN_associate.js"; | ||
import { updateHtmlResource } from "./functions/Resources/RESOUCRES_update.js"; | ||
|
||
var appBaseUrl = `${__ENV.MODEL_APPLICATION_BASE_URL}`; | ||
var appBasePath = `${__ENV.MODEL_APPLICATION_BASE_PATH}`; | ||
var token = `${__ENV.MODEL_APPLICATION_KEY}`; | ||
|
||
|
||
export const options = { | ||
thresholds: nameThresholds, | ||
scenarios: { low_load }, | ||
} | ||
|
||
|
||
export function handleSummary(data) { | ||
return { | ||
"performance_summary.html": htmlReport(data), | ||
}; | ||
} | ||
|
||
export default function () { | ||
getAllBpmn(appBaseUrl, token); | ||
associateRouteBpmn(appBaseUrl.concat(appBasePath),token,'performance_acquirer','BPMNassociate',1); | ||
updateHtmlResource(appBaseUrl.concat(appBasePath), token); | ||
} |
Oops, something went wrong.