RationaleEmotions/just-ask

hasCapability method returns true all the time in GhostProxy

Gytiss opened this issue · 4 comments

This method should not have Override:

    @Override
    public boolean hasCapability(Map<String, Object> requestedCapability) {
        return true;
    }

Due to above, if Grid does not have the capability, session is put in the queue instead of breaking straight away (like in default Grid). Also, if you do not set newSessionWaitTimeout parameter in Grid HUB start cmd, the session will wait indefinitely,
Also getNewSession should include this piece of code from default getNewSession method:

if (!hasCapability(requestedCapability)) {
        	LOG.fine("Node " + this + " has no matching capability");
          return null;
        }

I can open PR request for this if we agree it is needed.

I believe that hasCapability() was built to return true because it was an on-demand grid i.e., there are actually no nodes present till a new session can be created (that is where we spin off a docker container). So if we change this, then I doubt if the on-demand grid will work fine. Have you tested this to see what happens ?

Yes I actually did test it. It works fine, as you just need to pass browserName for Ghost proxy and since the capability matches it picks it up and spins the container. So the on-demand feature remains intact.

@Gytiss - Ok.. I will give this a whirl locally and see what happens later.. But if you have tested it, please go ahead and raise a PR for this as well..

Sure @krmahadevan . Opened PR for this one