I would like to use the SharedArray feature but invoke it after the Setup.
Why I want this is due that I will fill up the SharedArray after calling and receiving a list of items from a REST endpoint, which I will use its item id’s to request information to the API endpoint (the K6 test).
I have already in the setup some code that authenticates the client and gets me the bearer jwt token.
Is there a way to do this? And if so, how do I provide the Setup-generated token to the SharedArray function?
No, there are currently no such capabilities in k6. The closest you’d get would be to fetch either all, or a subset of, the items in each VU.
Then, I cannot use SharedArray… instead of reading a JSON file, I wanted to retrieve the sample data from the service… so I get the “real data” from the test system and then use it to insert & download…
Then I will try to do this on the setup function and hand over to the execution methods the built test data arrays… like shown here: Test life cycle (k6.io)
Although maybe not quite as slick as you envisioned it, that should definitely work.