Starts the signer moduler server on a separate task and returns its configuration
(port: u16)
| 88 | // Starts the signer moduler server on a separate task and returns its |
| 89 | // configuration |
| 90 | async fn start_server(port: u16) -> Result<StartSignerConfig> { |
| 91 | setup_test_env(); |
| 92 | let chain = Chain::Hoodi; |
| 93 | |
| 94 | // Mock JWT secrets |
| 95 | let module_id = ModuleId(JWT_MODULE.to_string()); |
| 96 | let mut jwts = HashMap::new(); |
| 97 | jwts.insert(module_id.clone(), JWT_SECRET.to_string()); |
| 98 | |
| 99 | // Create a signer config |
| 100 | let loader = SignerLoader::ValidatorsDir { |
| 101 | keys_path: "data/keystores/keys".into(), |
| 102 | secrets_path: "data/keystores/secrets".into(), |
| 103 | format: ValidatorKeysFormat::Lighthouse, |
| 104 | }; |
| 105 | let mut config = get_signer_config(loader); |
| 106 | config.port = port; |
| 107 | config.jwt_auth_fail_limit = 3; // Set a low fail limit for testing |
| 108 | config.jwt_auth_fail_timeout_seconds = 3; // Set a short timeout for testing |
| 109 | let start_config = get_start_signer_config(config, chain, jwts); |
| 110 | |
| 111 | // Run the Signer |
| 112 | let server_handle = tokio::spawn(SigningService::run(start_config.clone())); |
| 113 | |
| 114 | // Make sure the server is running |
| 115 | tokio::time::sleep(Duration::from_millis(100)).await; |
| 116 | if server_handle.is_finished() { |
| 117 | return Err(eyre::eyre!( |
| 118 | "Signer service failed to start: {}", |
| 119 | server_handle.await.unwrap_err() |
| 120 | )); |
| 121 | } |
| 122 | Ok(start_config) |
| 123 | } |
| 124 | |
| 125 | // Verifies that the pubkeys returned by the server match the pubkeys in the |
| 126 | // test data |
no test coverage detected