Skip to content

Commit d3c63c6

Browse files
committed
graph: add simple test to check graph can be generated successfully
1 parent bea13f7 commit d3c63c6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.github/workflows/test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ jobs:
2525
- uses: actions/checkout@v3
2626
- uses: ./.github/actions
2727
- run: ./test/rpc_test.py
28+
graph:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
- uses: ./.github/actions
33+
- run: ./test/test_graph.py

test/test_graph.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python3
2+
import tempfile
3+
import uuid
4+
from pathlib import Path
5+
from test_base import TestBase
6+
from warnet.utils import DEFAULT_TAG
7+
8+
base = TestBase()
9+
base.network = False
10+
base.start_server()
11+
12+
with tempfile.TemporaryDirectory() as dir:
13+
tf = f"{dir}/{str(uuid.uuid4())}.graphml"
14+
print(f"Writing test graph to {tf}")
15+
print(base.warcli(f"graph create n=10 --outfile={tf} --version={DEFAULT_TAG}", network=False))
16+
base.wait_for_predicate(lambda: Path(tf).exists())
17+
18+
# Test that the graph actually works
19+
print(base.warcli(f"network start {Path(tf)}"))
20+
base.wait_for_all_tanks_status(target="running")
21+
base.warcli("rpc 0 getblockcount")
22+
23+
base.stop_server()

0 commit comments

Comments
 (0)