Skip to content

Commit f900c5a

Browse files
authored
Merge pull request #707 from bitcoin-dev-project/init-logging
warnet init: add `metricsExport:true` if grafana is selected
2 parents ffa84ec + ca92185 commit f900c5a

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/warnet/graph.py

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def custom_graph(
8585

8686
# Configure logging
8787
defaults_yaml_content["collectLogs"] = logging
88+
defaults_yaml_content["metricsExport"] = logging
8889

8990
with open(os.path.join(datadir, "node-defaults.yaml"), "w") as f:
9091
yaml.dump(defaults_yaml_content, f, default_flow_style=False, sort_keys=False)

test/graph_test.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ def directory_exists(self):
3737
try:
3838
self.log.info("testing warnet create, dir does exist")
3939
self.sut = pexpect.spawn("warnet create")
40-
self.sut.expect("name", timeout=10)
40+
self.sut.expect("name", timeout=30)
4141
self.sut.sendline("ANewNetwork")
42-
self.sut.expect("many", timeout=10)
42+
self.sut.expect("many", timeout=30)
4343
self.sut.sendline("")
44-
self.sut.expect("connections", timeout=10)
44+
self.sut.expect("connections", timeout=30)
4545
self.sut.sendline("")
46-
self.sut.expect("version", timeout=10)
46+
self.sut.expect("version", timeout=30)
4747
self.sut.sendline("")
48-
self.sut.expect("enable fork-observer", timeout=10)
48+
self.sut.expect("enable fork-observer", timeout=30)
4949
self.sut.sendline("")
50-
self.sut.expect("seconds", timeout=10)
51-
self.sut.sendline("")
52-
self.sut.expect("enable grafana", timeout=10)
50+
self.sut.expect("seconds", timeout=30)
5351
self.sut.sendline("")
52+
self.sut.expect("enable grafana", timeout=30)
53+
self.sut.sendline("true")
5454
self.sut.expect("successfully", timeout=50)
5555
except Exception as e:
5656
print(f"\nReceived prompt text:\n {self.sut.before.decode('utf-8')}\n")
@@ -74,6 +74,10 @@ def run_created_network(self):
7474
assert debugs["mempool"]
7575
# santy check
7676
assert not debugs["zmq"]
77+
# verify that prometheus exporter is making its rpc calls
78+
self.wait_for_predicate(
79+
lambda: "method=getblockcount user=user" in self.warnet("logs tank-0000")
80+
)
7781

7882

7983
if __name__ == "__main__":

0 commit comments

Comments
 (0)