Skip to content

Commit 6ef0feb

Browse files
authored
Tidy up slow test scripts (#2684)
### What problem does this PR solve? Tidy up slow test scripts Issue link:#[Link the issue here] ### Type of change - [x] Refactoring
1 parent 699c9f5 commit 6ef0feb

File tree

6 files changed

+10
-76
lines changed

6 files changed

+10
-76
lines changed

conf/new_pytest_parallel_infinity_conf.toml

Lines changed: 0 additions & 31 deletions
This file was deleted.

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
markers =
3+
slow: Mark a test as slow-running, e.g., for tests that take longer to execute.
4+
complex: Mark a test as complex.

python/restart_test/infinity_runner.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
from abc import abstractmethod
21
import logging
32
import os
43
import subprocess
5-
import os
64
import psutil
75
import time
86
import infinity
9-
from infinity.common import ConflictType, InfinityException
7+
from infinity.common import InfinityException
108
from infinity.errors import ErrorCode
11-
from util import *
129

1310
PYTEST_LOG_FILE = "restart_test.py.log"
1411

@@ -18,10 +15,6 @@ def __init__(self, infinity_path: str, config_path: str, *, logger=None):
1815
self.data_dir = "/var/infinity"
1916
self.default_config_path = config_path
2017

21-
self.use_new_catalog = False
22-
if "new" in self.default_config_path:
23-
self.use_new_catalog = True
24-
2518
self.script_path = "./scripts/timeout_kill.sh"
2619
self.infinity_path = infinity_path
2720

@@ -52,17 +45,15 @@ def clear(self):
5245
os.system(
5346
f"rm -rf {self.data_dir}/catalog {self.data_dir}/data {self.data_dir}/log {self.data_dir}/persistence {self.data_dir}/tmp {self.data_dir}/wal"
5447
)
55-
os.system(f"rm -rf restart_test.log.*")
48+
os.system("rm -rf restart_test.log.*")
5649
os.system(f"rm -rf {PYTEST_LOG_FILE}")
5750
print(f"clear {self.data_dir}")
5851
self.i = 0
5952

6053
def init(self, config_path: str | None = None):
61-
init_timeout = 60
54+
# init_timeout = 60
6255
if config_path is None:
6356
config_path = self.default_config_path
64-
elif self.use_new_catalog:
65-
config_path = make_new_config(config_path)
6657

6758
cmd = f"{self.infinity_path} --config={config_path} > restart_test.log.{self.i} 2>&1"
6859

python/restart_test/util.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import threading
32

43

@@ -22,35 +21,3 @@ def join(self, *args):
2221
if self.exception_:
2322
raise self.exception_
2423
return self._rtn
25-
26-
# open toml file and
27-
# add "use_new_catalog = true" under [storage]
28-
def make_new_config(filepath: str):
29-
file_dir, filename = filepath.rsplit("/", 1)
30-
new_filename = filename.split(".")[0] + "_new.toml"
31-
new_filepath = file_dir + "/" + new_filename
32-
33-
if os.path.exists(new_filepath):
34-
return new_filepath
35-
36-
with open(filepath, "r") as f:
37-
lines = f.readlines()
38-
with open(new_filepath, "w") as f:
39-
for line in lines:
40-
if line.startswith("[storage]"):
41-
f.write(line)
42-
f.write("use_new_catalog = true\n")
43-
else:
44-
f.write(line)
45-
return new_filepath
46-
47-
# remove the new config file
48-
def remove_new_config(filepath: str):
49-
file_dir, filename = filepath.rsplit("/", 1)
50-
new_filename = filename.split(".")[0] + "_new.toml"
51-
new_filepath = file_dir + "/" + new_filename
52-
try:
53-
os.remove(new_filepath)
54-
except Exception as e:
55-
print(f"remove {new_filepath} failed: {e}")
56-
return new_filepath

tools/run_cluster_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"-m",
4343
"pytest",
4444
"-v",
45+
"--tb=short",
4546
test_case,
4647
f"--infinity_path={infinity_path}",
4748
"-x",

tools/run_restart_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"-m",
5555
"pytest",
5656
"-v",
57+
"--tb=short",
5758
test_case,
5859
f"--infinity_path={infinity_path}",
5960
"-x",
@@ -73,6 +74,7 @@
7374
"-m",
7475
"pytest",
7576
"-v",
77+
"--tb=short",
7678
test_case,
7779
f"--infinity_path={infinity_path}",
7880
"-x",

0 commit comments

Comments
 (0)