Parse user id from s3 and run one id per VU

Hello there,
I downloaded data from S3 via S3Client. Below is the data:
{“size”:188,“storageClass”:“STANDARD”,“data”:“fakeUserMF0000004\r\nfakeUserMF0000005\r\nfakeUserMF0000006\r\nfakeUserMF0000007\r\nfakeUserMF0000008\r\nfakeUserMF0000009\r\nfakeUserMF0000010\r\nfakeUserMF0000011\r\nfakeUserMF0000015\r\nfakeUserMF0000016”,“etag”:null,“key”:“3kMultiRep.csv”,“lastModified”:1665467135000}

Question: How do I parse those fakeUserMFxxxxxxx out of “data” key and then execute 1 per VU?

export function setup() {
// Download the S3 object containing the test data
const inputObject = s3.getObject(bucketName, testFileKey);
return JSON.stringify(iputObject.data);
}

export default function (data) {
const ids = JSON.stringify(data.data).replace(/“/g, “”).split(”\r\n");
console.log(ids[exec.vu.idInTest - 1]);
}

Hi @alex,

Welcome to the forum :tada:

Unfortunately, I’m not 100% certain I understand what you’re trying to achieve. Could you please clarify a few things so that we avoid misunderstandings? :bowing_man:

What I understood from your description is:

  1. you’re downloading a file from S3 in your setup phase, which contains some user IDs
  2. you parse those ids into an array
  3. you wish to use 1 VU per user-id, and have this VU execute N iterations of a function using exclusively this userID, as in “have VU 1 execute N iterations using UserID 1, have VU 2 execute N iterations using UserID 2, etc…”?

Some more questions that popped up while considering your issue:

  • do you know the number of user IDs beforehand?
  • do you absolutely need to run concurrent requests per-user ID (1 VU matches 1 UserID, or would you be okay with ensuring that a UserID is used at least N times per run?

Let me know :bowing_man: