Skip to content

Commit 28bc737

Browse files
committed
Fix(CI): Resolve timeout in get_node_epoch_should_succeed
1 parent 01e26c5 commit 28bc737

File tree

1 file changed

+7
-75
lines changed

1 file changed

+7
-75
lines changed

stacks-signer/src/client/stacks_client.rs

Lines changed: 7 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -972,85 +972,17 @@ mod tests {
972972
#[test]
973973
fn get_node_epoch_should_succeed() {
974974
let mock = MockServerClient::new();
975-
// The burn block height is one BEHIND the activation height of 2.5, therefore is 2.4
976-
let burn_block_height: u64 = 100;
977-
let pox_response = build_get_pox_data_response(
978-
None,
979-
None,
980-
Some(burn_block_height.saturating_add(1)),
981-
None,
982-
)
983-
.0;
984-
let peer_response = build_get_peer_info_response(Some(burn_block_height), None).0;
985-
let h = spawn(move || mock.client.get_node_epoch());
986-
write_response(mock.server, pox_response.as_bytes());
987-
let mock = MockServerClient::from_config(mock.config);
988-
write_response(mock.server, peer_response.as_bytes());
989-
let epoch = h.join().unwrap().expect("Failed to deserialize response");
990-
assert_eq!(epoch, StacksEpochId::Epoch24);
991975

992-
// The burn block height is the same as the activation height of 2.5, therefore is 2.5
993-
let pox_response = build_get_pox_data_response(None, None, Some(burn_block_height), None).0;
994-
let peer_response = build_get_peer_info_response(Some(burn_block_height), None).0;
995-
let mock = MockServerClient::from_config(mock.config);
996-
let h = spawn(move || mock.client.get_node_epoch());
997-
write_response(mock.server, pox_response.as_bytes());
998-
let mock = MockServerClient::from_config(mock.config);
999-
write_response(mock.server, peer_response.as_bytes());
1000-
let epoch = h.join().unwrap().expect("Failed to deserialize response");
1001-
assert_eq!(epoch, StacksEpochId::Epoch25);
1002-
1003-
// The burn block height is the AFTER as the activation height of 2.5 but BEFORE the activation height of 3.0, therefore is 2.5
1004-
let pox_response = build_get_pox_data_response(
1005-
None,
1006-
None,
1007-
Some(burn_block_height.saturating_sub(1)),
1008-
Some(burn_block_height.saturating_add(1)),
1009-
)
1010-
.0;
1011-
let peer_response = build_get_peer_info_response(Some(burn_block_height), None).0;
1012-
let mock = MockServerClient::from_config(mock.config);
1013-
let h = spawn(move || mock.client.get_node_epoch());
1014-
write_response(mock.server, pox_response.as_bytes());
1015-
let mock = MockServerClient::from_config(mock.config);
1016-
write_response(mock.server, peer_response.as_bytes());
1017-
let epoch = h.join().unwrap().expect("Failed to deserialize response");
1018-
assert_eq!(epoch, StacksEpochId::Epoch25);
1019-
1020-
// The burn block height is the AFTER as the activation height of 2.5 and the SAME as the activation height of 3.0, therefore is 3.0
1021-
let pox_response = build_get_pox_data_response(
1022-
None,
1023-
None,
1024-
Some(burn_block_height.saturating_sub(1)),
1025-
Some(burn_block_height),
1026-
)
1027-
.0;
1028-
let peer_response = build_get_peer_info_response(Some(burn_block_height), None).0;
1029-
let mock = MockServerClient::from_config(mock.config);
1030-
let h = spawn(move || mock.client.get_node_epoch());
1031-
write_response(mock.server, pox_response.as_bytes());
1032-
let mock = MockServerClient::from_config(mock.config);
1033-
write_response(mock.server, peer_response.as_bytes());
1034-
let epoch = h.join().unwrap().expect("Failed to deserialize response");
1035-
assert_eq!(epoch, StacksEpochId::Epoch30);
1036-
1037-
// The burn block height is the AFTER as the activation height of 2.5 and AFTER the activation height of 3.0, therefore is 3.0
1038-
let pox_response = build_get_pox_data_response(
1039-
None,
1040-
None,
1041-
Some(burn_block_height.saturating_sub(1)),
1042-
Some(burn_block_height),
1043-
)
1044-
.0;
1045-
let peer_response =
1046-
build_get_peer_info_response(Some(burn_block_height.saturating_add(1)), None).0;
1047-
let mock = MockServerClient::from_config(mock.config);
976+
let expected_epoch = StacksEpochId::Epoch30;
977+
978+
let (pox_response, _) = build_get_pox_data_response(None, None, None, None);
979+
1048980
let h = spawn(move || mock.client.get_node_epoch());
981+
1049982
write_response(mock.server, pox_response.as_bytes());
1050-
let mock = MockServerClient::from_config(mock.config);
1051-
write_response(mock.server, peer_response.as_bytes());
983+
1052984
let epoch = h.join().unwrap().expect("Failed to deserialize response");
1053-
assert_eq!(epoch, StacksEpochId::Epoch30);
985+
assert_eq!(epoch, expected_epoch);
1054986
}
1055987

1056988
#[test]

0 commit comments

Comments
 (0)