-
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.
Merge pull request #12 from pagopa/PAGOPA-658-pipeline-perf-test
Pagopa 658 pipeline perf test
- Loading branch information
Showing
8 changed files
with
60 additions
and
153 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
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
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 |
---|---|---|
@@ -1,75 +1,42 @@ | ||
import http from 'k6/http'; | ||
import { check } from 'k6'; | ||
import { SharedArray } from 'k6/data'; | ||
import { randomOrg } from './modules/helpers.js'; | ||
|
||
import { createOrganization, deleteOrganization } from "./modules/orgsEnrollment_client.js"; | ||
|
||
//k6 run -o influxdb=http://influxdb:8086/k6 -e BASE_URL=http://localhost:8085 performance-test/src/full_load_test.js | ||
//k6 run performance-test/src/full_load_test.js | ||
export let options = JSON.parse(open(__ENV.TEST_TYPE)); | ||
|
||
// read configuration | ||
// note: SharedArray can currently only be constructed inside init code | ||
// according to https://k6.io/docs/javascript-api/k6-data/sharedarray | ||
const varsArray = new SharedArray('vars', function() { | ||
return JSON.parse(open(`./${__ENV.VARS}`)).environment; | ||
const varsArray = new SharedArray('vars', function () { | ||
return JSON.parse(open(`${__ENV.VARS}`)).environment; | ||
}); | ||
|
||
// workaround to use shared array (only array should be used) | ||
const vars = varsArray[0]; | ||
const orgsEnrollmentHost = `${vars.orgsEnrollmentHost}`; | ||
const numberOfEventsToPreload = `${vars.numberOfEventsToPreload}`; | ||
|
||
const accountPrimaryKey = `${__ENV.API_SUBSCRIPTION_KEY}`; | ||
|
||
export function setup() { | ||
} | ||
|
||
function precondition() { | ||
// no pre conditions | ||
} | ||
|
||
function postcondition(organizationFiscalCode) { | ||
|
||
// Delete the newly created organization. | ||
let tag = { | ||
gpdMethod: "DeleteOrganization", | ||
}; | ||
|
||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
}; | ||
|
||
const r = deleteOrganization(orgsEnrollmentHost, organizationFiscalCode, params); | ||
|
||
console.log("Delete organization " + organizationFiscalCode + " " + r.status); | ||
|
||
check(r, { | ||
"DeleteOrganization status is 200": (_r) => r.status === 200, | ||
}, tag); | ||
} | ||
const rootUrl = `${vars.host}`; | ||
|
||
export default function(data) { | ||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Ocp-Apim-Subscription-Key': __ENV.API_SUBSCRIPTION_KEY | ||
}, | ||
}; | ||
|
||
const frameworkType = `?frameworkType=quarkus` | ||
|
||
// Create an organization | ||
let tag = { | ||
orgsEnrollmentMethod: "CreateOrganization", | ||
}; | ||
export default function () { | ||
|
||
const params = { | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
}; | ||
const organization_fiscal_code = randomOrg(11, "0123456789"); | ||
|
||
let mockOrganizationFiscalCode = 'mockOrganizationFiscalCode'; | ||
console.log(orgsEnrollmentHost + 'organization/' + mockOrganizationFiscalCode); | ||
// Create new debt position (no validity date). | ||
|
||
const response = createOrganization(orgsEnrollmentHost, mockOrganizationFiscalCode, params); | ||
var url = `${rootUrl}/organizations/${organization_fiscal_code}${frameworkType}`; | ||
|
||
console.log(`CreateOrganization ... ${response.status}`); | ||
var r = http.post(url, "", params); | ||
|
||
check(response, {"CreateOrganization status is 201": (res) => (res.status === 201)}, tag); | ||
console.log("CreateOrganization call - organization_fiscal_code = " + organization_fiscal_code + ", Status = " + r.status); | ||
|
||
postcondition(mockOrganizationFiscalCode, params); | ||
} | ||
check(r, { | ||
'CreateOrganization status is 201': (r) => r.status === 201, | ||
}); | ||
} |
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 was deleted.
Oops, something went wrong.
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