Skip to content

Commit

Permalink
update: add separate ENV vars for Node configs
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Nguyen Duc <nguyenducviet4496@gmail.com>
  • Loading branch information
VietND96 committed Feb 11, 2024
1 parent b1d36d5 commit 85b708f
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 29 deletions.
15 changes: 15 additions & 0 deletions NodeBase/start-selenium-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ if [ ! -z "$SE_NODE_SESSION_TIMEOUT" ]; then
SE_OPTS="$SE_OPTS --session-timeout ${SE_NODE_SESSION_TIMEOUT}"
fi

if [ ! -z "$SE_NODE_ENABLE_MANAGED_DOWNLOADS" ]; then
echo "Appending Selenium options: --enable-managed-downloads ${SE_NODE_ENABLE_MANAGED_DOWNLOADS}"
SE_OPTS="$SE_OPTS --enable-managed-downloads ${SE_NODE_ENABLE_MANAGED_DOWNLOADS}"
fi

if [ ! -z "$SE_NODE_ENABLE_CDP" ]; then
echo "Appending Selenium options: --enable-cdp ${SE_NODE_ENABLE_CDP}"
SE_OPTS="$SE_OPTS --enable-cdp ${SE_NODE_ENABLE_CDP}"
fi

if [ ! -z "$SE_NODE_REGISTER_PERIOD" ]; then
echo "Appending Selenium options: --register-period ${SE_NODE_REGISTER_PERIOD}"
SE_OPTS="$SE_OPTS --register-period ${SE_NODE_REGISTER_PERIOD}"
fi

if [ ! -z "$SE_LOG_LEVEL" ]; then
echo "Appending Selenium options: --log-level ${SE_LOG_LEVEL}"
SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}"
Expand Down
15 changes: 15 additions & 0 deletions Standalone/start-selenium-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@ if [ ! -z "$SE_OPTS" ]; then
echo "Appending Selenium options: ${SE_OPTS}"
fi

if [ ! -z "$SE_NODE_ENABLE_MANAGED_DOWNLOADS" ]; then
echo "Appending Selenium options: --enable-managed-downloads ${SE_NODE_ENABLE_MANAGED_DOWNLOADS}"
SE_OPTS="$SE_OPTS --enable-managed-downloads ${SE_NODE_ENABLE_MANAGED_DOWNLOADS}"
fi

if [ ! -z "$SE_NODE_ENABLE_CDP" ]; then
echo "Appending Selenium options: --enable-cdp ${SE_NODE_ENABLE_CDP}"
SE_OPTS="$SE_OPTS --enable-cdp ${SE_NODE_ENABLE_CDP}"
fi

if [ ! -z "$SE_NODE_REGISTER_PERIOD" ]; then
echo "Appending Selenium options: --register-period ${SE_NODE_REGISTER_PERIOD}"
SE_OPTS="$SE_OPTS --register-period ${SE_NODE_REGISTER_PERIOD}"
fi

if [ ! -z "$SE_LOG_LEVEL" ]; then
echo "Appending Selenium options: --log-level ${SE_LOG_LEVEL}"
SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}"
Expand Down
3 changes: 0 additions & 3 deletions docker-compose-v3-video-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ services:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_OPTS=--enable-managed-downloads true

edge:
image: selenium/node-edge:nightly
Expand All @@ -24,7 +23,6 @@ services:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_OPTS=--enable-managed-downloads true

firefox:
image: selenium/node-firefox:nightly
Expand All @@ -35,7 +33,6 @@ services:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_OPTS=--enable-managed-downloads true

chrome_video:
image: selenium/video:nightly
Expand Down
22 changes: 12 additions & 10 deletions tests/SeleniumTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,18 @@ def run(self, test_classes):
print(traceback.format_exc())
print(f"{str(test)} failed with exception: {str(e)}")
print(f"Original exception: {e.__cause__}")
print(f"Number of failed tests: {len(failed_tests)}")
for test in failed_tests:
try:
print(f"Rerunning test: {str(test)}")
test.run()
except Exception as e:
print(traceback.format_exc())
print(f"Test {str(test)} failed again with exception: {str(e)}")
print(f"Original exception: {e.__cause__}")
raise Exception(f"Rerun test failed: {str(test)} failed with exception: {str(e)}")
if len(failed_tests) > 0:
print(f"Number of failed tests: {len(failed_tests)}. Going to rerun!")
for test in failed_tests:
try:
print(f"Rerunning test: {str(test)}")
test.run()
except Exception as e:
print(traceback.format_exc())
print(f"Test {str(test)} failed again with exception: {str(e)}")
print(f"Original exception: {e.__cause__}")
raise Exception(f"Rerun test failed: {str(test)} failed with exception: {str(e)}")
print(f"::warning:: Number of failed tests: {len(failed_tests)}. All tests passed in rerun!")

class DeploymentAutoscalingTests(unittest.TestCase):
def test_parallel_autoscaling(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/charts/ci/DeploymentAutoscaling-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ chromeNode:
# NodePort will be assigned randomly if not set
nameOverride: my-chrome-name
extraEnvironmentVariables: &extraEnvironmentVariables
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"
- name: SE_VNC_NO_PASSWORD
value: "true"
- name: SE_SCREEN_WIDTH
Expand Down
4 changes: 2 additions & 2 deletions tests/charts/ci/JobAutoscaling-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ autoscaling:
chromeNode:
nameOverride: my-chrome-name
extraEnvironmentVariables: &extraEnvironmentVariables
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"
- name: SE_VNC_NO_PASSWORD
value: "true"
- name: SE_SCREEN_WIDTH
Expand Down
4 changes: 2 additions & 2 deletions tests/charts/ci/NodeChrome-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ chromeNode:
port: 6666
nameOverride: my-chrome-name
extraEnvironmentVariables:
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"
# Configuration for edge nodes
edgeNode:
enabled: false
Expand Down
4 changes: 2 additions & 2 deletions tests/charts/ci/NodeEdge-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edgeNode:
port: 8888
nameOverride: my-edge-name
extraEnvironmentVariables:
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"
# Configuration for firefox nodes
firefoxNode:
enabled: false
4 changes: 2 additions & 2 deletions tests/charts/ci/NodeFirefox-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ firefoxNode:
port: 7777
nameOverride: my-firefox-name
extraEnvironmentVariables:
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"
4 changes: 2 additions & 2 deletions tests/charts/refValues/sample-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ chromeNode:
value: "300"
- name: SE_VNC_NO_PASSWORD
value: "true"
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"

firefoxNode:
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
Expand Down
4 changes: 2 additions & 2 deletions tests/charts/refValues/simplex-minikube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ chromeNode:
value: "300"
- name: SE_VNC_NO_PASSWORD
value: "true"
- name: SE_OPTS
value: "--enable-managed-downloads true"
- name: SE_NODE_ENABLE_MANAGED_DOWNLOADS
value: "true"

firefoxNode:
extraEnvironmentVariables: *extraEnvironmentVariablesNodes
Expand Down
2 changes: 1 addition & 1 deletion tests/docker-compose-v3-test-video.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_OPTS=--enable-managed-downloads true
- SE_NODE_ENABLE_MANAGED_DOWNLOADS=true
ports:
- "6900:5900"

Expand Down
2 changes: 1 addition & 1 deletion tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def launch_container(container, **kwargs):
'SE_EVENT_BUS_SUBSCRIBE_PORT': 4443
}
if container != 'Hub':
environment['SE_OPTS'] = "--enable-managed-downloads true"
environment['SE_NODE_ENABLE_MANAGED_DOWNLOADS'] = "true"
container_id = client.containers.run("%s/%s:%s" % (NAMESPACE, IMAGE_NAME_MAP[container], VERSION),
detach=True,
environment=environment,
Expand Down

0 comments on commit 85b708f

Please sign in to comment.