chore(e2e): add manual override for networking in Linux#1552
chore(e2e): add manual override for networking in Linux#1552robertwilde wants to merge 2 commits intosiemens:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request aims to allow overriding network settings for e2e tests, particularly for WSL users. The change in e2e-local.sh attempts to set default values for LOCAL_ADDRESS and NETWORK_MODE on Linux only if they are not already set. However, the current implementation has a flaw that causes it to break the existing configuration for Linux. I've left a comment with a suggested fix to correctly implement the intended behavior while staying within the scope of the change.
e2e-local.sh
Outdated
| if [ -z "$LOCAL_ADDRESS" ]; then | ||
| LOCAL_ADDRESS=localhost | ||
| fi | ||
| if [ -z "$NETWORK_MODE" ]; then | ||
| NETWORK_MODE=host | ||
| fi |
There was a problem hiding this comment.
The current logic for setting default values for LOCAL_ADDRESS and NETWORK_MODE on Linux is not working as intended. These variables are initialized on lines 33-34, so the [ -z ... ] checks on lines 39 and 42 will always evaluate to false. This results in the Linux configuration incorrectly using the default bridge network mode and $BRIDGE_ADDRESS instead of host and localhost, which is a regression from the previous behavior.
To correctly allow overrides while setting Linux-specific defaults, you could instead check if the variables still hold the initial non-Linux default values and then replace them. This ensures that user-provided overrides are respected.
| if [ -z "$LOCAL_ADDRESS" ]; then | |
| LOCAL_ADDRESS=localhost | |
| fi | |
| if [ -z "$NETWORK_MODE" ]; then | |
| NETWORK_MODE=host | |
| fi | |
| if [ "$LOCAL_ADDRESS" = "$BRIDGE_ADDRESS" ]; then | |
| LOCAL_ADDRESS=localhost | |
| fi | |
| if [ "$NETWORK_MODE" = "bridge" ]; then | |
| NETWORK_MODE=host | |
| fi |
When setting up Playwright tests in Windows using WSL, I found that the docker container has trouble connecting to localhost:4200. To be able to pass another address a slight change needs to be made to e2e-local.sh