Skip to content

Commit 0313f18

Browse files
committed
Added unique ports to unit tests for parallel execution
1 parent 6464638 commit 0313f18

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/tests/signer_jwt_auth.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const JWT_SECRET: &str = "test-jwt-secret";
2121
async fn test_signer_jwt_auth_success() -> Result<()> {
2222
setup_test_env();
2323
let module_id = ModuleId(JWT_MODULE.to_string());
24-
let start_config = start_server().await?;
24+
let start_config = start_server(20100).await?;
2525

2626
// Run a pubkeys request
2727
let jwt = create_jwt(&module_id, JWT_SECRET)?;
@@ -39,7 +39,7 @@ async fn test_signer_jwt_auth_success() -> Result<()> {
3939
async fn test_signer_jwt_auth_fail() -> Result<()> {
4040
setup_test_env();
4141
let module_id = ModuleId(JWT_MODULE.to_string());
42-
let start_config = start_server().await?;
42+
let start_config = start_server(20200).await?;
4343

4444
// Run a pubkeys request - this should fail due to invalid JWT
4545
let jwt = create_jwt(&module_id, "incorrect secret")?;
@@ -59,7 +59,7 @@ async fn test_signer_jwt_auth_fail() -> Result<()> {
5959
async fn test_signer_jwt_rate_limit() -> Result<()> {
6060
setup_test_env();
6161
let module_id = ModuleId(JWT_MODULE.to_string());
62-
let start_config = start_server().await?;
62+
let start_config = start_server(20300).await?;
6363

6464
// Run as many pubkeys requests as the fail limit
6565
let jwt = create_jwt(&module_id, "incorrect secret")?;
@@ -88,7 +88,7 @@ async fn test_signer_jwt_rate_limit() -> Result<()> {
8888

8989
// Starts the signer moduler server on a separate task and returns its
9090
// configuration
91-
async fn start_server() -> Result<StartSignerConfig> {
91+
async fn start_server(port: u16) -> Result<StartSignerConfig> {
9292
setup_test_env();
9393
let chain = Chain::Hoodi;
9494

@@ -104,6 +104,7 @@ async fn start_server() -> Result<StartSignerConfig> {
104104
format: ValidatorKeysFormat::Lighthouse,
105105
};
106106
let mut config = get_signer_config(loader);
107+
config.port = port;
107108
config.jwt_auth_fail_limit = 3; // Set a low fail limit for testing
108109
config.jwt_auth_fail_timeout_seconds = 3; // Set a short timeout for testing
109110
let start_config = get_start_signer_config(config, chain, jwts);

0 commit comments

Comments
 (0)