Skip to content

Commit 2c8b270

Browse files
committed
fix: safer check for stacks tip height in prom assertion
1 parent b17874c commit 2c8b270

File tree

1 file changed

+3
-43
lines changed

1 file changed

+3
-43
lines changed

testnet/stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,13 +1490,15 @@ fn simple_neon_integration() {
14901490
{
14911491
let prom_http_origin = format!("http://{}", prom_bind);
14921492
let client = reqwest::blocking::Client::new();
1493+
let info = get_chain_info_result(&naka_conf).unwrap();
1494+
let stacks_tip_height = info.stacks_tip_height;
14931495
let res = client
14941496
.get(&prom_http_origin)
14951497
.send()
14961498
.unwrap()
14971499
.text()
14981500
.unwrap();
1499-
let expected_result = format!("stacks_node_stacks_tip_height {block_height_pre_3_0}");
1501+
let expected_result = format!("stacks_node_stacks_tip_height {stacks_tip_height}");
15001502
assert!(res.contains(&expected_result));
15011503
}
15021504

@@ -5979,33 +5981,6 @@ fn signer_chainstate() {
59795981
let burnchain = naka_conf.get_burnchain();
59805982
let sortdb = burnchain.open_sortition_db(true).unwrap();
59815983

5982-
// query for prometheus metrics
5983-
#[cfg(feature = "monitoring_prom")]
5984-
{
5985-
let (chainstate, _) = StacksChainState::open(
5986-
naka_conf.is_mainnet(),
5987-
naka_conf.burnchain.chain_id,
5988-
&naka_conf.get_chainstate_path_str(),
5989-
None,
5990-
)
5991-
.unwrap();
5992-
let block_height_pre_3_0 =
5993-
NakamotoChainState::get_canonical_block_header(chainstate.db(), &sortdb)
5994-
.unwrap()
5995-
.unwrap()
5996-
.stacks_block_height;
5997-
let prom_http_origin = format!("http://{}", prom_bind);
5998-
let client = reqwest::blocking::Client::new();
5999-
let res = client
6000-
.get(&prom_http_origin)
6001-
.send()
6002-
.unwrap()
6003-
.text()
6004-
.unwrap();
6005-
let expected_result = format!("stacks_node_stacks_tip_height {block_height_pre_3_0}");
6006-
assert!(res.contains(&expected_result));
6007-
}
6008-
60095984
info!("Nakamoto miner started...");
60105985
blind_signer(&naka_conf, &signers, proposals_submitted.clone());
60115986

@@ -6601,21 +6576,6 @@ fn continue_tenure_extend() {
66016576
.unwrap()
66026577
.stacks_block_height;
66036578

6604-
// query for prometheus metrics
6605-
#[cfg(feature = "monitoring_prom")]
6606-
{
6607-
let prom_http_origin = format!("http://{}", prom_bind);
6608-
let client = reqwest::blocking::Client::new();
6609-
let res = client
6610-
.get(&prom_http_origin)
6611-
.send()
6612-
.unwrap()
6613-
.text()
6614-
.unwrap();
6615-
let expected_result = format!("stacks_node_stacks_tip_height {block_height_pre_3_0}");
6616-
assert!(res.contains(&expected_result));
6617-
}
6618-
66196579
info!("Nakamoto miner started...");
66206580
blind_signer(&naka_conf, &signers, proposals_submitted);
66216581

0 commit comments

Comments
 (0)