Skip to content

Commit 9f9a2a8

Browse files
implementing docker for local memgraph tests and reorganizing
1 parent 11cb326 commit 9f9a2a8

File tree

11 files changed

+23
-11
lines changed

11 files changed

+23
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
3939
- name: Set up Neo4j data
4040
run: |
41-
python tests/initialize_db.py "${GITHUB_SHA}"
41+
python tests/neo4j/initialize_neo4j.py "${GITHUB_SHA}"
4242
4343
- name: Run pytest
4444
run: |

.github/workflows/test_pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ jobs:
4141
4242
- name: Set up Neo4j data
4343
run: |
44-
python tests/initialize_neo4j.py "${GITHUB_SHA}"
44+
python tests/neo4j/initialize_neo4j.py "${GITHUB_SHA}"
4545
4646
- name: Set up Memgraph data
4747
run: |
48-
python tests/initialize_memgraph.py "${GITHUB_SHA}"
48+
python tests/memgraph/initialize_memgraph.py "${GITHUB_SHA}"
4949
5050
- name: Run pytest
5151
run: |

tests/memgraph/docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
memgraph:
3+
container_name: memgraph
4+
image: memgraph/memgraph-mage:3.3
5+
ports:
6+
- '7688:7687'
7+
volumes:
8+
- ./memgraph_json/:/memgraph_json
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,23 @@ def main(hash: str = None):
3636
driver = get_driver(url)
3737
LOGGER.info("Connected to Memgraph. Initializing...")
3838
if hash is not None:
39-
node_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner-transpiler/{hash}/tests/memgraph_json/nodes.json"
40-
edge_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner-transpiler/{hash}/tests/memgraph_json/edges.json"
39+
node_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner-transpiler/{hash}/tests/memgraph/memgraph_json/nodes.json"
40+
edge_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner-transpiler/{hash}/tests/memgraph/memgraph_json/edges.json"
41+
load_technique = "json_util.load_from_url"
4142
else:
42-
node_file = f"file:///nodes.csv"
43-
edge_file = f"file:///edges.csv"
43+
# NOTE this path works because it's mounted in the docker container that way
44+
node_file = f"/memgraph_json/nodes.json"
45+
edge_file = f"/memgraph_json/edges.json"
46+
load_technique = "json_util.load_from_path"
4447
with driver.session() as session:
4548
print(edge_file)
4649
session.run("MATCH (m) DETACH DELETE m")
47-
result = session.run(f"CALL json_util.load_from_url(\"{node_file}\") YIELD objects "
50+
result = session.run(f"CALL {load_technique}(\"{node_file}\") YIELD objects "
4851
"UNWIND objects AS node "
4952
"CREATE (n:`biolink:NamedThing`:node.category {id: node.id, name: node.name, length: node.length, chromosome: node.chromosome})"
5053
"RETURN count(*);")
5154
print(f'Nodes added: {result.single()["count(*)"]}')
52-
result = session.run(f"CALL json_util.load_from_url(\"{edge_file}\") YIELD objects "
55+
result = session.run(f"CALL {load_technique}(\"{edge_file}\") YIELD objects "
5356
"UNWIND objects AS edge "
5457
"MATCH (s {id: edge.subject}), (o {id: edge.object}) "
5558
"CREATE (s)-[x:edge.predicate "
File renamed without changes.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ def main(hash: str = None):
3939
driver = get_driver(url)
4040
LOGGER.info("Connected to Neo4j. Initializing...")
4141
if hash is not None:
42-
node_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner/{hash}/tests/neo4j_csv/nodes.csv"
43-
edge_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner/{hash}/tests/neo4j_csv/edges.csv"
42+
node_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner-transpiler/{hash}/tests/neo4j/neo4j_csv/nodes.csv"
43+
edge_file = f"https://raw.githubusercontent.com/ranking-agent/reasoner-transpiler/{hash}/tests/neo4j/neo4j_csv/edges.csv"
4444
else:
45+
# NOTE this path works because it's mounted in the docker container that way
4546
node_file = f"file:///nodes.csv"
4647
edge_file = f"file:///edges.csv"
4748
with driver.session() as session:

0 commit comments

Comments
 (0)