Skip to content

Commit f7189e1

Browse files
committed
Add couple more text detection if server is really up.
Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
1 parent 2878aef commit f7189e1

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

test/test_container_upgrade.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,13 @@ def create_database_in_prev_version(self):
8989
)
9090
is_db_ready = False
9191
for _ in range(5):
92-
output = PodmanCLIWrapper.podman_logs(container_id=cid_create)
93-
print(output)
94-
if "accepting connections" in output:
95-
is_db_ready = True
96-
break
97-
time.sleep(5)
92+
output = PodmanCLIWrapper.podman_logs(container_id=cid_upg)
93+
for out in ["accepting connections", "Starting server"]:
94+
if out not in output:
95+
time.sleep(5)
96+
continue
97+
is_db_ready = True
98+
break
9899
assert is_db_ready, "Database is not ready after waiting for 25 seconds"
99100
if self.datadir == "empty":
100101
sql_cmd = "CREATE TABLE blah (id int);"
@@ -117,8 +118,6 @@ def create_database_in_prev_version(self):
117118
cmd=f"run --rm -i {VARS.IMAGE_NAME} bash -c '{psql_cmd}' < {file_path}",
118119
)
119120
self.check_pagila_db(cid=cid_create)
120-
# PodmanCLIWrapper.call_podman_command(cmd=f"stop {cid_create}")
121-
# PodmanCLIWrapper.call_podman_command(cmd=f"rm -f {cid_create}")
122121

123122
def upgrade_image(self, upgrade_type: str, bool_test_upgrade: bool = True):
124123
"""
@@ -147,10 +146,12 @@ def upgrade_image(self, upgrade_type: str, bool_test_upgrade: bool = True):
147146
is_db_ready = False
148147
for _ in range(5):
149148
output = PodmanCLIWrapper.podman_logs(container_id=cid_upg)
150-
if "accepting connections" in output:
151-
is_db_ready = True
152-
break
153-
time.sleep(5)
149+
for out in ["accepting connections", "Starting server"]:
150+
if out not in output:
151+
time.sleep(5)
152+
continue
153+
is_db_ready = True
154+
break
154155
assert is_db_ready, "Database is not ready after waiting for 25 seconds"
155156
assert output
156157
if self.datadir == "empty":

0 commit comments

Comments
 (0)