For load testing in the vu
stage I generate a lot of objects with unique ids that I put them in the database. I want to delete them during teardown
stage in order not to pollute the database.
When keeping the state like this
let ids = [];
export function setup() {
ids.push('put in setup id');
}
export default function () {
ids.push('put in vu id');
}
export function teardown() {
ids.push('put in teardown id');
console.log('Resources: ' + ids);
}
it doesn't work as the array always contains the data I put in teardown
stage.
Passing data between stages also doesn't work due to well-know Cannot extend Go slice
issue, but even with that, you cannot pass the data from vu
stage to teardown
as it always gets the data from setup
stage.
The only remaining solution is either playing around with console log
or just use a plain preset of ids and use them in tests. Is there another way?