-
Notifications
You must be signed in to change notification settings - Fork 28
/
test_e2e_correctness.py
78 lines (61 loc) · 1.85 KB
/
test_e2e_correctness.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python3
import os
import subprocess
import argparse
WORK_DIRECTORY = os.getcwd()
E2E_CORRECTNESS_DIRECTORY = f"{WORK_DIRECTORY}/e2e_correctness"
class ConfigConstants:
NEO4J_PORT = 7688
MEMGRAPH_PORT = 7687
def parse_arguments():
parser = argparse.ArgumentParser(description="Test MAGE E2E correctness.")
parser.add_argument(
"-k",
help="Filter what tests you want to run",
type=str,
required=False,
)
parser.add_argument(
"--memgraph-port",
help="Set the port that Memgraph is listening on",
type=int,
required=False,
)
parser.add_argument(
"--neo4j-port",
help="Set the port that Neo4j is listening on",
type=int,
required=False,
)
args = parser.parse_args()
return args
#################################################
# End to end tests #
#################################################
def main(
test_filter: str = None,
memgraph_port: str = str(ConfigConstants.MEMGRAPH_PORT),
neo4j_port: str = str(ConfigConstants.NEO4J_PORT),
):
os.environ["PYTHONPATH"] = E2E_CORRECTNESS_DIRECTORY
os.chdir(E2E_CORRECTNESS_DIRECTORY)
command = ["python3", "-m", "pytest", ".", "-vv"]
if test_filter:
command.extend(["-k", test_filter])
command.extend(["--memgraph-port", memgraph_port])
command.extend(["--neo4j-port", neo4j_port])
subprocess.run(command)
if __name__ == "__main__":
args = parse_arguments()
test_filter = args.k
memgraph_port = args.memgraph_port
neo4j_port = args.neo4j_port
if memgraph_port:
memgraph_port = str(memgraph_port)
if neo4j_port:
neo4j_port = str(neo4j_port)
main(
test_filter=test_filter,
memgraph_port=memgraph_port,
neo4j_port=neo4j_port,
)