Commit cc8f4da0 authored by Jérome Perrin's avatar Jérome Perrin

software/seleniumserver: add a promise to wait for all nodes to register

We are sometimes seeing test failures when nodes can not register before the
beginning of the test, this promise make sure the grid is ready to use.
parent e3a5e2a6
Pipeline #14814 running with stage
...@@ -19,4 +19,4 @@ md5sum = c4ac5de141ae6a64848309af03e51d88 ...@@ -19,4 +19,4 @@ md5sum = c4ac5de141ae6a64848309af03e51d88
[template-selenium] [template-selenium]
filename = instance-selenium.cfg.in filename = instance-selenium.cfg.in
md5sum = fc2e8176929063903a69b0e80007ca63 md5sum = eea51d25c292c7ea305229184e380814
...@@ -66,6 +66,7 @@ port = 4444 ...@@ -66,6 +66,7 @@ port = 4444
base-url = http://$${:hostname}:$${:port} base-url = http://$${:hostname}:$${:port}
url = $${:base-url}/wd/hub url = $${:base-url}/wd/hub
register-url = $${:base-url}/grid/register/ register-url = $${:base-url}/grid/register/
api-url = $${:base-url}/grid/api/hub
[selenium-server-node-instance] [selenium-server-node-instance]
...@@ -259,6 +260,7 @@ instance-promises = ...@@ -259,6 +260,7 @@ instance-promises =
$${sshd-listen-promise:name} $${sshd-listen-promise:name}
$${selenium-server-frontend-listen-promise:name} $${selenium-server-frontend-listen-promise:name}
$${selenium-server-hub-listen-promise:name} $${selenium-server-hub-listen-promise:name}
$${selenium-server-hub-nodes-registered-promise:name}
$${selenium-server-node-firefox-52-listen-promise:name} $${selenium-server-node-firefox-52-listen-promise:name}
$${selenium-server-node-firefox-60-listen-promise:name} $${selenium-server-node-firefox-60-listen-promise:name}
$${selenium-server-node-firefox-68-listen-promise:name} $${selenium-server-node-firefox-68-listen-promise:name}
...@@ -285,6 +287,30 @@ config-port = $${selenium-server-frontend-instance:port} ...@@ -285,6 +287,30 @@ config-port = $${selenium-server-frontend-instance:port}
config-hostname = $${selenium-server-hub-instance:hostname} config-hostname = $${selenium-server-hub-instance:hostname}
config-port = $${selenium-server-hub-instance:port} config-port = $${selenium-server-hub-instance:port}
# Promise waiting for all nodes to be registered
[selenium-server-hub-nodes-registered-promise]
<= monitor-promise-base
module = check_command_execute
name = $${:_buildout_section_name_}.py
config-command =
$${selenium-server-check-nodes-registered:rendered} $${selenium-server-hub-instance:api-url} $${:expected-node-count}
# We have 4 nodes with 3 slots each
expected-node-count = 12
[selenium-server-check-nodes-registered]
recipe = slapos.recipe.template:jinja2
rendered = $${directory:bin}/$${:_buildout_section_name_}
mode = 0755
template =
inline:
#!${buildout:executable}
import json, urllib, sys
api_url = sys.argv[1]
expected_node_count = int(sys.argv[2])
actual_node_count = json.load(urllib.urlopen(api_url))['slotCounts']['total']
sys.exit(0 if expected_node_count == actual_node_count else 1)
[selenium-server-node-firefox-52-listen-promise] [selenium-server-node-firefox-52-listen-promise]
<= check-port-listening-promise <= check-port-listening-promise
config-hostname = $${selenium-server-node-instance-firefox-52:hostname} config-hostname = $${selenium-server-node-instance-firefox-52:hostname}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment