Skip to content

Commit

Permalink
graph: add simple test to check graph can be generated successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
willcl-ark committed Nov 2, 2023
1 parent bea13f7 commit d3c63c6
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ jobs:
- uses: actions/checkout@v3
- uses: ./.github/actions
- run: ./test/rpc_test.py
graph:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions
- run: ./test/test_graph.py
23 changes: 23 additions & 0 deletions test/test_graph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
import tempfile
import uuid
from pathlib import Path
from test_base import TestBase
from warnet.utils import DEFAULT_TAG

base = TestBase()
base.network = False
base.start_server()

with tempfile.TemporaryDirectory() as dir:
tf = f"{dir}/{str(uuid.uuid4())}.graphml"
print(f"Writing test graph to {tf}")
print(base.warcli(f"graph create n=10 --outfile={tf} --version={DEFAULT_TAG}", network=False))
base.wait_for_predicate(lambda: Path(tf).exists())

# Test that the graph actually works
print(base.warcli(f"network start {Path(tf)}"))
base.wait_for_all_tanks_status(target="running")
base.warcli("rpc 0 getblockcount")

base.stop_server()

0 comments on commit d3c63c6

Please sign in to comment.