MCPcopy Create free account
hub / github.com/Commit-Boost/commit-boost-client / test_ssv_network_fetch

Function test_ssv_network_fetch

tests/tests/pbs_mux.rs:28–60  ·  view source on GitHub ↗

Tests that a successful SSV network fetch is handled and parsed properly

()

Source from the content-addressed store, hash-verified

26#[tokio::test]
27/// Tests that a successful SSV network fetch is handled and parsed properly
28async fn test_ssv_network_fetch() -> Result<()> {
29 // Start the mock server
30 let port = 30100;
31 let _server_handle = create_mock_ssv_server(port, None).await?;
32 let url =
33 Url::parse(&format!("http://localhost:{port}/api/v4/test_chain/validators/in_operator/1"))
34 .unwrap();
35 let response =
36 fetch_ssv_pubkeys_from_url(url, Duration::from_secs(HTTP_TIMEOUT_SECONDS_DEFAULT)).await?;
37
38 // Make sure the response is correct
39 // NOTE: requires that ssv_data.json dpesn't change
40 assert_eq!(response.validators.len(), 3);
41 let expected_pubkeys = [
42 bls_pubkey_from_hex_unchecked(
43 "967ba17a3e7f82a25aa5350ec34d6923e28ad8237b5a41efe2c5e325240d74d87a015bf04634f21900963539c8229b2a",
44 ),
45 bls_pubkey_from_hex_unchecked(
46 "ac769e8cec802e8ffee34de3253be8f438a0c17ee84bdff0b6730280d24b5ecb77ebc9c985281b41ee3bda8663b6658c",
47 ),
48 bls_pubkey_from_hex_unchecked(
49 "8c866a5a05f3d45c49b457e29365259021a509c5daa82e124f9701a960ee87b8902e87175315ab638a3d8b1115b23639",
50 ),
51 ];
52 for (i, validator) in response.validators.iter().enumerate() {
53 assert_eq!(validator.pubkey, expected_pubkeys[i]);
54 }
55
56 // Clean up the server handle
57 _server_handle.abort();
58
59 Ok(())
60}
61
62#[tokio::test]
63/// Tests that the SSV network fetch is handled properly when the response's

Callers

nothing calls this directly

Calls 3

create_mock_ssv_serverFunction · 0.85

Tested by

no test coverage detected