Resource setup for use by multiple users

I’ve got a system to test the crux of which is multiple users making use of entities creating by an earlier user, i.e. Users X create a resource and a URL is created for using it, Users Y then make lots of use of those URLs.

I can’t quite make this fit with Gatling. So far I’ve got something like this:

scenario.exec(url.create, url.invoke. url.delete).inject(fixedUsers(1))

This doesn’t achieve my goal, as those fixedUsers are representing both X’s and Y’s, each user creates it’s own resource and then calls and deletes it. I could wrap the ‘invoke’ with a repeat like structure, but that also doesn’t achieve my goal as I need concurrency on single Url’s and in fact it’s at that point I want to make use for the user ramping, other other powers.

The next stage seems to be something abit like: (excuse the bad pseudo code please, I’ve edited down the session value injection because it’s just noisey, I know it doesn’t look at all like this)

before {
invokeUrl = url.create()
session.set("invokeUrl", invokeUrl)
}

scenario.exec(url.invoke(session("invokeUrl").inject(fixedUsers(Y))

Here the url is created in the before, and I can then make use of the user ramping facilities in the invoke stage. However, I have no control now over X’s, it’s just a one shot thing, and I can’t test how the system reacts when there are lots of invokeUrls being invoked by lots of users.

In order to get that ability, I’m thinking of trying something like:

before{
invokeUrls = [url.create(), url.create(), etc, etc actually user a loop of course]
session.set("invokeUrls", invokeUrls)
}

scenario.exec(invoke().inject(fixedUsers(Y))

val invoke = scenario(http.post(session("invokeUrl").getIndex(userNumber%invokeUrls.size)))

Here we create an array of all the invokeUrls and then index into it using modulo the user number, i.e. which Y it is (i don’t know how to get that, but imagine it can be done), with the number of urls available.

Another idea I had was to use a feeder to loop around the array in the session, but this is pretty much the same thing. It feels like I’m working against Gatling somewhat, it’s not very tidy at all. I’d far rather have the setup by a separate section of the scenario with it’s own user pool, but from my reading that looks like it’s not possible.

So, my question is: Does this sound like a sensible solution?