Closed ayemelyanenko-chegg closed 7 months ago
Hello @ayemelyanenko-chegg, Thank you for your report. I reproduced the issue.
For the Team: It can be reproduced locally with the k3s Kubernetes distribution. Steps to reproduce:
Clone this example repo: https://github.com/Dmitry-Ostashev/testcafe-kubernetes-example.
Build an image:
docker build -t your-hub-id/testcafe-experiment .
Push it to your docker hub.
Specify an image name with our hub id in the ./k8s/test.yaml file instead of mine.
Create kubernetes deployment:
sudo kubectl apply -f ./k8s/test.yaml
Wait a few seconds while the pod is being prepared. Check its status with the following command:
sudo kubectl get pods
Remember the pod's name for the next step.
When the status is 'Running', you can execute the command for launching a test:
sudo kubectl exec -it %your-pod-name% -- npx testcafe chrome:headless example.js
The task will fail with a browser connection error.
Launch a test with the chrome flags mentioned above:
sudo kubectl exec -it %your-pod-name% -- npx testcafe 'chrome:headless --no-sandbox --disable-dev-shm-usage' example.js
It will pass without errors.
Any chance that this can be looked at and possibly fixed? I'm seeing intermittent connectivity issues in kubernetes even with the flags passed in.
As far as resources go, I think they should be able to handle 5 concurrent browsers as I'm overriding kubernetes cpu and memory requests
KUBERNETES_CPU_REQUEST: 4 KUBERNETES_MEMORY_REQUEST: 8Gi
We cannot give any estimates on a fix. If this issue is critical, you can prepare a pull request by yourself. We would appreciate that.
Besides, take a look at the following thread: https://github.com/DevExpress/testcafe/issues/2946. Perhaps, it can help you solve the problem with concurrency.
Thanks for the response @Dmitry-Ostashev
I encountered a similar problem but not on AWS. Just inside a custom docker image. My tests run on an alpine based image. The software that gets tested runs on the same host in another docker container run by docker compose with a reverse proxy. But even without the reverse proxy, the TestCafe Runner waits the full browser init timeout and the exits with no established browser connection. Also I cannot get a running test inside a docker container. The flags passed to the browser is not working for me (but have always been in place)
ERROR Cannot establish one or more browser connections.
1 of 1 browser connections have not been established:
- chromium:headless:width=1800;height=1000 --no-sandbox --disable-dev-shm-usage --no-discard-tabs
Hints:
- Increase the value of the "browserInitTimeout" option if it is too low (currently: 2 minutes for all browsers). This option determines how long TestCafe waits for browsers to be ready.
- The error can also be caused by network issues or remote device failure. Make sure that your network connection is stable and you can reach the remote device.
Execution:
node --max_old_space_size=16384 node_modules/testcafe/bin/testcafe-with-v8-flag-filter.js --no-color 'chromium:headless:width=1800;height=1000 --no-sandbox --disable-dev-shm-usage --no-discard-tabs' src/tests/smoke/parallel/common --concurrency 1
Hi @pschmolke,
The Cannot establish one or browser connection
error message will be displayed in all cases when TestCafe cannot connect to a browser. Let's keep this issue only for the Running tests in Kubernetes
case.
Just inside a custom docker image.
In most cases, it's an issue with a custom docker container's setup. If you can share an example to reproduce this issue locally, please create a separate issue for your case.
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.
What is your Scenario?
Running tests with Chrome on the AWS Kubernetes version 1.24
https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html#kubernetes-1.24
What is the Current behavior?
Running tests with Chrome on the AWS Kubernetes version 1.24 causes browsers to disconnect nearly each time unless --no-sandbox --disable-dev-shm-usage is passed as a flag to Chrome
I believe this is happening because of:
Running tests with Chrome on the AWS Kubernetes version 1.23 works fine and doesn't require a Chrome flag above
What is the Expected behavior?
The browsers should not disconnect nearly each time when running on AWS Kubernetes version 1.24
What is your public website URL? (or attach your complete example)
There is no website for this issue
What is your TestCafe test code?
Your complete configuration file
No response
Your complete test report
No response
Screenshots
This is a simple test that runs on AWS Kubernetes 1.24 and it fails each time
This is a simple test that runs on AWS Kubernetes 1.23 and it passes each time
This is a simple test that runs on AWS Kubernetes 1.24 with the Chrome flag and it passes each time
Steps to Reproduce
TestCafe version
2.5.1-rc.1
Node.js version
18.16.0
Command-line arguments
For failure: yarn run testcafe chrome:headless' testcafe/sampleTest.ts -e -c 10
For pass: yarn run testcafe 'chrome:headless --no-sandbox --disable-dev-shm-usage' testcafe/sampleTest.ts -e -c 10
Browser name(s) and version(s)
Chrome 112.0.5615.165
Platform(s) and version(s)
No response
Other
No response