Skip to content

Commit 255ff56

Browse files
committed
ci: re-enable some graph tests
1 parent 4b5cbad commit 255ff56

File tree

3 files changed

+29
-31
lines changed

3 files changed

+29
-31
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
matrix:
3535
# test: [scenarios_test.py, rpc_test.py, graph_test.py, ln_test.py, dag_connection_test.py, logging_test.py]
36-
test: [rpc_test.py, scenarios_test.py]
36+
test: [graph_test.py, rpc_test.py, scenarios_test.py]
3737
steps:
3838
- uses: actions/checkout@v4
3939
- uses: hynek/setup-cached-uv@v1

src/warnet/cli/util.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def create_cycle_graph(n: int, version: str, bitcoin_conf: str | None, random_ve
7474
graph.nodes[node]["build_args"] = ""
7575
graph.nodes[node]["exporter"] = False
7676
graph.nodes[node]["collect_logs"] = False
77-
graph.nodes[node]["resources"] = None
7877

7978
convert_unsupported_attributes(graph)
8079
return graph

test/graph_test.py

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from pathlib import Path
88

99
from test_base import TestBase
10-
from warnet.lnd import LNDNode
10+
11+
# from warnet.lnd import LNDNode
1112
from warnet.utils import DEFAULT_TAG
1213

1314

@@ -24,20 +25,19 @@ def __init__(self):
2425
def run_test(self):
2526
self.test_graph_creation_and_import()
2627
self.validate_graph_schema()
27-
28-
self.start_server()
2928
try:
30-
self.test_graph_with_optional_services()
29+
# TODO: re-enable these when we add lightning back
30+
# self.test_graph_with_optional_services()
3131
self.test_created_graph()
32-
self.test_imported_graph()
32+
# self.test_imported_graph()
3333
finally:
3434
self.stop_server()
3535

3636
def test_graph_creation_and_import(self):
3737
self.log.info(f"CLI tool creating test graph file: {self.tf_create}")
3838
self.log.info(
3939
self.warcli(
40-
f"graph create 10 --outfile={self.tf_create} --version={DEFAULT_TAG}", network=False
40+
f"graph create 10 --outfile={self.tf_create} --version={DEFAULT_TAG}"
4141
)
4242
)
4343
self.wait_for_predicate(lambda: Path(self.tf_create).exists())
@@ -46,16 +46,15 @@ def test_graph_creation_and_import(self):
4646
self.log.info(
4747
self.warcli(
4848
f"graph import-json {self.json_file_path} --outfile={self.tf_import} --ln_image=carlakirkcohen/lnd:attackathon --cb=carlakirkcohen/circuitbreaker:attackathon-test",
49-
network=False,
5049
)
5150
)
5251
self.wait_for_predicate(lambda: Path(self.tf_import).exists())
5352

5453
def validate_graph_schema(self):
5554
self.log.info("Validating graph schema")
56-
assert "invalid" not in self.warcli(f"graph validate {Path(self.tf_create)}", False)
57-
assert "invalid" not in self.warcli(f"graph validate {Path(self.tf_import)}", False)
58-
assert "invalid" not in self.warcli(f"graph validate {self.graph_file_path}", False)
55+
assert "invalid" not in self.warcli(f"graph validate {Path(self.tf_create)}")
56+
assert "invalid" not in self.warcli(f"graph validate {Path(self.tf_import)}")
57+
assert "invalid" not in self.warcli(f"graph validate {self.graph_file_path}")
5958

6059
def test_graph_with_optional_services(self):
6160
self.log.info("Testing graph with optional services...")
@@ -70,7 +69,7 @@ def test_graph_with_optional_services(self):
7069

7170
def test_created_graph(self):
7271
self.log.info("Testing created graph...")
73-
self.log.info(self.warcli(f"network start {Path(self.tf_create)} --force"))
72+
self.log.info(self.warcli(f"network start {Path(self.tf_create)}"))
7473
self.wait_for_all_tanks_status(target="running")
7574
self.wait_for_all_edges()
7675
self.warcli("bitcoin rpc 0 getblockcount")
@@ -79,7 +78,7 @@ def test_created_graph(self):
7978

8079
def test_imported_graph(self):
8180
self.log.info("Testing imported graph...")
82-
self.log.info(self.warcli(f"network start {Path(self.tf_import)} --force"))
81+
self.log.info(self.warcli(f"network start {Path(self.tf_import)}"))
8382
self.wait_for_all_tanks_status(target="running")
8483
self.wait_for_all_edges()
8584
self.warcli("bitcoin rpc 0 getblockcount")
@@ -90,23 +89,23 @@ def test_imported_graph(self):
9089

9190
def verify_ln_channel_policies(self):
9291
self.log.info("Ensuring warnet LN channel policies match imported JSON description")
93-
with open(self.json_file_path) as file:
94-
actual = json.loads(self.warcli("ln rpc 0 describegraph"))["edges"]
95-
expected = json.loads(file.read())["edges"]
96-
expected = sorted(expected, key=lambda chan: int(chan["channel_id"]))
97-
for chan_index, actual_chan_json in enumerate(actual):
98-
expected_chan = LNDNode.lnchannel_from_json(expected[chan_index])
99-
actual_chan = LNDNode.lnchannel_from_json(actual_chan_json)
100-
if not expected_chan.channel_match(actual_chan):
101-
self.log.info(
102-
f"Channel {chan_index} policy mismatch, testing flipped channel: {actual_chan.short_chan_id}"
103-
)
104-
if not expected_chan.channel_match(actual_chan.flip()):
105-
raise Exception(
106-
f"Channel policy doesn't match source: {actual_chan.short_chan_id}\n"
107-
+ f"Actual:\n{actual_chan}\n"
108-
+ f"Expected:\n{expected_chan}\n"
109-
)
92+
# with open(self.json_file_path) as file:
93+
# actual = json.loads(self.warcli("ln rpc 0 describegraph"))["edges"]
94+
# expected = json.loads(file.read())["edges"]
95+
# expected = sorted(expected, key=lambda chan: int(chan["channel_id"]))
96+
# for chan_index, actual_chan_json in enumerate(actual):
97+
# expected_chan = LNDNode.lnchannel_from_json(expected[chan_index])
98+
# actual_chan = LNDNode.lnchannel_from_json(actual_chan_json)
99+
# if not expected_chan.channel_match(actual_chan):
100+
# self.log.info(
101+
# f"Channel {chan_index} policy mismatch, testing flipped channel: {actual_chan.short_chan_id}"
102+
# )
103+
# if not expected_chan.channel_match(actual_chan.flip()):
104+
# raise Exception(
105+
# f"Channel policy doesn't match source: {actual_chan.short_chan_id}\n"
106+
# + f"Actual:\n{actual_chan}\n"
107+
# + f"Expected:\n{expected_chan}\n"
108+
# )
110109

111110

112111
if __name__ == "__main__":

0 commit comments

Comments
 (0)