Closed aidanhyland closed 4 years ago
Hi @aidanhyland
I am fine thanks!
The plugin is written to use a single instance of the ntlm-proxy, and if it finds another instance on startup it will try to shut it down. This all comes down to how the local proxy urls used by the cypress end of the plugin are transferred - they are written to a specific file. So there cannot be multiple instances of that same file.
I see two possible approaches for you:
Use the same ntlm-proxy instance for all 4 agents. To accomplish this, you would need to start your test session by starting ntlm-proxy on the server (see the npm run ntlm-proxy
script in the readme). Then spawn you agents, but run the tests by calling only cypress-ntlm (this may be confusing, since the npm run script example in the readme named cypress-ntlm also calls ntlm-proxy, the point is to make a modified script that does not call ntlm-proxy, or ntlm-proxy-exit, which shall be used by the agents). When all test agents have completed, you use ntlm-proxy-exit to shut down the proxy.
Keep in mind that this will only work if all your tests can use the same credentials. You cannot call cy.ntlmReset from any of the test agents since that will break the sessions for the other agents.
Containers. As long as the containers "hide" the host file system, and the config file written by the plugin is unique within each container, this should work fine. The config file is stored in:
/home/[username]/cypress-ntlm-auth/cypress-ntlm-auth.port
/Users/[username]/Library/Application Support/cypress-ntlm-auth/cypress-ntlm-auth.port
C:\Users\[username]\AppData\Roaming\cypress-ntlm-auth\cypress-ntlm-auth.port
Hi @bjowes ,
Appreciate the super quick reply & thanks for the recommendations.
Our DevOps team are building out the Docker capabilites so option 2 might be the route I take.
I have been trying option 1 to-date with no resolution as our tests do perform an ntlm.reset() to switch users during test execution :(
Aidan
Ok, I hope the containers pan out for you.
It would be possible to extend the ntlm-proxy to handle multiple cypress instances in parallell, but it isn't trivial to implement. If you would like to give it a go, I would be happy to receive a PR for it. Since this is the first time I've heard of it I think it is an uncommon use case for the users of this plugin.
I'll close this, please reopen if you can't get by with the containers.
On windows, how can I test if the proxy is already running and not run npm run ntlm-proxy
?
@MSIH - this is a closed issue, please open a new one for questions. There is no simple API for this, but two possible approaches:
@aidanhyland - Multiple instances of the proxy are now supported, released in 3.0.0
Really great stuff, I'll be sure to let me fellow colleagues know. Thanks for the tag.
Hi @bjowes,
Hope you are well.
Not sure if this is an issue but hoping you can provide an explanation or a work around to my issue.
The Env
I see authentication issues in the scenario where two spec files (starting the NTML proxy) on different agents but the same server. There is confliction. The proxy reboots or doesn't allow muliplte connections
Have you encountered issues where multiple tests start the ntlm-proxy or connect to the same proxy and fail?
I added a process check on the server for the ntlm-proxy to avoid tests starting it when active and likewise for stopping but nothing has work so far.
I'm considering to containerize the spec executions.