Skip to content

Commit

Permalink
Increase the timeout in the containers (#1547)
Browse files Browse the repository at this point in the history
* increase wait time

* increase logging
  • Loading branch information
gmmeyer authored and masci committed May 29, 2018
1 parent fe1f4cd commit 318deb3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mysql/tests/compose/maria.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ services:
- ${WAIT_FOR_IT_SCRIPT_PATH}:/usr/local/bin/wait-for-it.sh
depends_on:
- "mysql-slave"
command: ["wait-for-it.sh", "mysql-master:3306", "-t", "30", "--", "setup_mysql.sh"]
command: ["wait-for-it.sh", "mysql-master:3306", "-t", "120", "--", "setup_mysql.sh"]


networks:
Expand Down
4 changes: 2 additions & 2 deletions mysql/tests/compose/mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
- ${WAIT_FOR_IT_SCRIPT_PATH}:/usr/local/bin/wait-for-it.sh
networks:
- network1
command: ["wait-for-it.sh", "mysql-master:3306", "-t", "30", "--", "replication-entrypoint.sh", "mysqld"]
command: ["wait-for-it.sh", "mysql-master:3306", "-t", "120", "--", "replication-entrypoint.sh", "mysqld"]
depends_on:
- "mysql-master"

Expand All @@ -37,7 +37,7 @@ services:
- ${WAIT_FOR_IT_SCRIPT_PATH}:/usr/local/bin/wait-for-it.sh
depends_on:
- "mysql-slave"
command: ["wait-for-it.sh", "mysql-master:3306", "-t", "30", "--", "setup_mysql.sh"]
command: ["wait-for-it.sh", "mysql-master:3306", "-t", "120", "--", "setup_mysql.sh"]


networks:
Expand Down
17 changes: 14 additions & 3 deletions mysql/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def wait_for_mysql():
Wait for the slave to connect to the master
"""
connected = False
for i in xrange(0, 50):
for i in xrange(0, 100):
try:
pymysql.connect(
host=common.HOST,
Expand All @@ -38,8 +38,7 @@ def wait_for_mysql():
connected = True
return True
except Exception as e:
pass
log.debug("exception: {0}".format(e))
log.debug("exception: {}".format(e))
time.sleep(2)

return connected
Expand Down Expand Up @@ -70,6 +69,18 @@ def spin_up_mysql():
subprocess.check_call(args + ["up", "-d"], env=env)
# wait for the cluster to be up before yielding
if not wait_for_mysql():
containers = [
"compose_mysql-master_1",
"compose_mysql-slave_1",
"compose_mysql-setup_1",
]
for container in containers:
args = [
"docker",
"logs",
container,
]
subprocess.check_call(args, env=env)
raise Exception("not working")
yield
subprocess.check_call(args + ["down"], env=env)
Expand Down

0 comments on commit 318deb3

Please sign in to comment.