How to support multiple environments/DNS in Selenium Grid? - selenium

I have a suite of automated tests that run on a Selenium Grid. I have a need now to run these tests in multiple environments (QA, Stage, Production). The environments will be set up using a different DNS server for each one. So a test targeting the QA environment should use the QA DNS, Stage tests should use the Stage DNS, etc.
Ideally, I would like my test suite (which runs in Jenkins and accepts a parameter for which environment to target) to be able to tell the grid to allocate a node, set its DNS servers to (whatever), run the test, then put the DNS servers back the way it found them.
I don't see anything in Selenium's documentation about changing DNS settings on the individual nodes. I also tried looking for browser capabilities that could handle this, but no luck there either. What's the cleanest way to make this happen?
EDIT: The requirement to switch DNS servers is a new one, so there's currently no method in place (manual or automatic) for doing it. Before using this DNS-based method of differentiating environments, we were using environment-specific hostfiles, and switching between them with a custom service that listened on each node for a hostfile-switch request. We might have to create a similar service for switching DNS settings, but I was hoping there was something more "official" than that.

We worked around this issue by setting up a proxy server for each environment, and configuring the proxy servers to use the environment-specific DNS settings. Selenium permits setting a proxy on the individual nodes, so this was a way to programatically modify those settings.

Related

How do I serve different Ktor modules on different ports?

I've got an application that I'm trying to serve different modules (with different application/routings) on different ports.
This is so that I can then restrict port access by different subnets.
Is this possible, and if so, how do I do it?
Alternatively, I can run multiple ktor servers within my application, but was recommended against it due to how ktor optimizes to run in the JVM.
Would love some guidance on this, thanks!

Wireguard with dynamic setup for iot

At the moment we have multiple raspberry pies placed at different locations on different networks.
Our current solution to be able to reach them if something goes wrong is auto-ssh with jump host.
Recently I stumbled on Wireguard which could be another more slim way to solve the calling home problem.
The problem is that we would like the setup phase to be more dynamic, we don't want to do special configuration per node we have out there, we just want them to call home with a key and then be apart of the network.
Two questions:
Is Wireguard for us or are there other problems that I can't foresee here.
Is there a way to set it up dynamically with one key and let the clients get random ips?
wireguard always needs a unique keypair / host. So not what you are looking for.
If you just want a phone home option with ip connectivity I would suggest an openvpn server and client. If you use a username/password config (not using certificates), you can reuse the config on multiple clients. Openvpn will act as an dhcp server.
an howto:
https://openvpn.net/community-resources/how-to/
search for:
client-cert-not-required
The option that Maxim Sagaydachny is also valid for command access, an alternative to salt could be puppet with mco/bolt.
On any option you choose, be sure that the daemon restarts when it crashes, reboots, fails...
for systemd services this would be an override with:
[service]
restart=always

Distributed selenium grid and http proxy

I have seen many questions about using Selenium behind proxy where selenium nodes are connecting to internet via proxy. The solution is indicated everywhere is to specify proxy settings in the code when creating the webdriver instance.
Unfortunately in my case this is not going to work, as I am using a distributed selenium grid where different nodes require different proxy settings. When a test is run, the test running only communicates with the grid hub and does not have any control over what node it will run over - thus setting proxy from inside the test is not possible. Each node is a linux machine with both Firefox and Chrome running in virtual framebuffer. Presently the grid has about 25 nodes distributed across multiple data centers, but this number may grow to anywhere up to 1000 in the future.
There are business reasons for such a setup - and I am not in a position (both technically and politically) to change them.
Is there any way to set proxy on a node level and have it apply to everything that's happening on that node only?
Apparently, all I need to do is to define http_proxy and https_proxy environment variables, which chrome will then honour.
For firefox, proxy parameters can be added to /etc/firefox-$version/pref/firefox.js where $version can be determined by running firefox -v | awk '{print substr($3,1,3)}'.

spy-js not capturing from chrome behind a corporate firewall with a proxy

I am not able to capture any information when starting spy-js on Intellij IDEA 15. I think I'm being defeated by proxies. My setup is as follows:
system:
OS X version 10.10.5
network:
I work behind a corporate firewall with proxy servers. These proxies are set at the system level and also at the bash shell level. HTTP_PROXY, http_proxy, http.proxy etc are all set.
web server: My web server runs on a remote system within the corporate network over port 80
gulp:
I run gulp serve-debug to start my local development web proxy. I use browsersync. So I have my website at localhost:3000, and this maps to some-corp-location/ui
spy-js config:
At the moment, it looks like this (though I've thrashed about and tried many things)
I followed the advice I've found to check chrome://net-internals/#proxy and it never shows the spy-js proxy settings, it always only shows the corporate proxy settings. This is why I'm pretty sure I'm getting burned by proxies. I tried looking at the chrome proxy settings to see if I could disassociate it with the system settings, but it wasn't clear if this would work out or not.

Spring Cloud Config: differentiate configs for service instances

Spring Cloud Config serves configuration based on app name, profile and label.
I'm wondering, how to differentiate configuration of two instances of same service on same environment. They should basically have the same configuration, but, for example, I would like to allow on testing environment running them on the same host, so I need different ports.
How you solve this? Using fake profiles (dev-1, dev2)? Or is there some better way?
There is no facility for individual instance configuration as you noted. You could do a fake profile thing. But for port, why not just set server.port?