Skip to content

Commit

Permalink
fix style and black
Browse files Browse the repository at this point in the history
  • Loading branch information
CheSema committed Dec 19, 2023
1 parent 939d602 commit b4fec61
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docker/test/stateful/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function start()
tail -n1000 /var/log/clickhouse-server/clickhouse-server.log
break
fi
timeout_with_logging 120 service clickhouse-server start
timeout 120 service clickhouse-server start
sleep 0.5
counter=$((counter + 1))
done
Expand Down Expand Up @@ -163,7 +163,7 @@ function run_tests()
}

export -f run_tests
timeout_with_logging "$MAX_RUN_TIME" bash -c run_tests ||:
timeout "$MAX_RUN_TIME" bash -c run_tests ||:

echo "Files in current directory"
ls -la ./
Expand Down
37 changes: 21 additions & 16 deletions tests/clickhouse-test
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ def need_retry(args, stdout, stderr, total_time):
msg in stderr for msg in MESSAGES_TO_RETRY
)


def get_processlist_size(args):
if args.replicated_database:
return int(
Expand All @@ -286,27 +287,26 @@ def get_processlist_size(args):
"""
SELECT
count()
FROM
FROM
FROM system.processes
WHERE query NOT LIKE '%system.processes%'
FORMAT Vertical
""",
).strip()
).strip()
)
else:
return int(
clickhouse_execute(
clickhouse_execute(
args,
"""
SELECT
count()
FROM system.processes
WHERE query NOT LIKE '%system.processes%'
FORMAT Vertical
""",
SELECT
count()
FROM system.processes
WHERE query NOT LIKE '%system.processes%'
""",
).strip()
)


def get_processlist_with_stacktraces(args):
if args.replicated_database:
return clickhouse_execute(
Expand Down Expand Up @@ -356,7 +356,6 @@ def get_processlist_with_stacktraces(args):
)



def get_transactions_list(args):
try:
if args.replicated_database:
Expand Down Expand Up @@ -2448,7 +2447,7 @@ def main(args):

if args.hung_check:
# Some queries may execute in background for some time after test was finished. This is normal.
print("Checking the hung queries: ", end='')
print("Checking the hung queries: ", end="")
hung_count = 0
try:
deadline = datetime.now() + timedelta(seconds=90)
Expand All @@ -2457,24 +2456,30 @@ def main(args):
if hung_count == 0:
print(" done")
break
print(". ", end='')
print(". ", end="")
except Exception as e:
print(
colored(
"\nHung check failed. Failed to get processlist size: " + str(e), args, "red", attrs=["bold"]
"\nHung check failed. Failed to get processlist size: " + str(e),
args,
"red",
attrs=["bold"],
)
)
exit_code.value = 1


processlist = ""
if hung_count > 0:
try:
processlist = get_processlist_with_stacktraces(args)
except Exception as e:
print(
colored(
"\nHung check failed. Failed to get processlist with stacktraces: " + str(e), args, "red", attrs=["bold"]
"\nHung check failed. Failed to get processlist with stacktraces: "
+ str(e),
args,
"red",
attrs=["bold"],
)
)
exit_code.value = 1
Expand Down

0 comments on commit b4fec61

Please sign in to comment.