mhardin / SeleniumGridScaler

Selenium Grid auto scaling plugin utilizing AWS
GNU General Public License v2.0
111 stars 51 forks source link

Can we get a 202 after a 201? #22

Open aheward opened 6 years ago

aheward commented 6 years ago

So, I send a call to the grid to spin up some nodes. I get back a 201, which means that things aren't yet ready for tests to start.

If I send a second request to the same URI, however, I get a 409.

How am I supposed to know when things are ready to go? I'd like to have an end point to query and get back a 202, so that I know it's okay to start the actual test cases.

mhardin commented 6 years ago

@aheward you're getting a 409 because you're calling in with the same UUID. The nodes generally take around 2 minutes to come up, so I'll add a wait in my code, or you can also check the grid console page to look for free resources before starting your tests.

Hope this helps.

aheward commented 6 years ago

So imagine the following scenario:

Isn't that second request going to spin up another 40 nodes, so I'll now have 80? Or is it going to use those first 40 and just overwrite that first UUID? What's the point of that first UUID, then?

As for checking the grid console page, what would you recommend I (or rather, my automation, since I'm asleep at home when these tests are set to run) check for on there?

mhardin commented 6 years ago

@aheward my point was, you're getting the 409 error because you're calling in a second time with the same UUID. So, even though you already got a response that says resources are successfully starting up for that UUID, you are requesting more resources with the same UUID (which is not supported).

The 2 minute hack was just a quick and easy suggestion if you wanted something quick and dirty.

For the grid console page, I would parse the HTTP call and look for elements to exist (nodes that are able to take test load on).

aheward commented 6 years ago

My point is that "successfully starting up" is not the same thing as "ready for tests to run" and it would be nice to query the API for that.

This seemed like a pretty straightforward request.

mhardin commented 6 years ago

@aheward we could add something, it would just be a matter of implementation -- does the API return once all nodes are started up? Or after at least one node is started up?

Also, Selenium should give you the ability to just queue your tests up against the hub and they should start fulfilling once the nodes come online.

Feel free to create a PR with the changes in this project; otherwise I'm not sure when I'll have time to get around to this.

ambirag commented 6 years ago

@aheward @mhardin 409 is returned if your request is over the limit of -DtotalNodeCount. If your hub start script has -DtotalNodeCount=40, and you request 40 in your first request and another 40 in the second request (with or without same UUID), then the hub is going to return 409 means you are requesting more than what the hub is allowed to have at one point of time because of -DtotalNodeCount=40). Instead of sending a request again to the hub to check if nodes are up, i have a script which checks a) if hub is up 2) checks if nodes are being shown in the http://hupip:4444/grid/console page.

status=$(curl -v --silent --connect-timeout 10 --max-time 10 http://HUBIP:4444/grid/console --stderr - | grep -o "OS : LINUX" | wc -l;) , this will give you number of nodes attached to the hub