testing: check for mysqld process when waiting for server
On my machine, mysqld dies shortly after startup. The current code
attempts connections for many seconds before timing out. We have
a handle on the mysqld process. So let's verify it is running and
abort if it goes away.
MozReview-Commit-ID: FakcPXxDeJt
--- a/testing/docker/builder-bmoweb/entrypoint.py
+++ b/testing/docker/builder-bmoweb/entrypoint.py
@@ -122,16 +122,21 @@ mysqld = subprocess.Popen([
'--init-file=/tmp/mysql-init.sh'])
# Wait for database to start or we may attempt to connect before it is
# ready.
time_start = time.time()
while True:
try:
print('attempting to connect to database...')
+
+ if mysqld.poll() is not None:
+ print('mysqld process exited %d' % mysqld.returncode)
+ sys.exit(1)
+
# There appear to be race conditions between MySQL opening the socket
# and MySQL actually responding. So we wait on a successful MySQL
# connection before continuing.
mysql.connector.connect(user=db_user, password=db_pass,
unix_socket='/dev/shm/mysqld.sock')
print('connected to MySQL database as %s' % db_user)
break
except (ConnectionError, mysql.connector.errors.Error) as e: