testing: check for mysqld process when waiting for server draft
authorGregory Szorc <gps@mozilla.com>
Mon, 31 Jul 2017 13:35:51 -0700
changeset 11428 13ef978e7d8c098ed56aa1aa2e6eb263f909bcf9
parent 11427 8c32d62e7f1625b7acd0f5926cb2eec0b95a94a4
child 11429 500f518b05bd5c1061291e47d5d313e6df21db00
push id1746
push userbmo:gps@mozilla.com
push dateThu, 03 Aug 2017 02:22:07 +0000
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
testing/docker/builder-bmoweb/entrypoint.py
--- 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: