From b33a6774bb5c89540377fad203ccb5b318d73226 Mon Sep 17 00:00:00 2001 From: Kevin Zou Date: Tue, 13 Feb 2024 15:09:14 -0500 Subject: [PATCH] reinit api instance on config change --- tests/main.rs | 5 +++++ tests/scenarios/fixtures.rs | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/tests/main.rs b/tests/main.rs index fb6ae691f..691fe10d0 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -56,10 +56,15 @@ async fn main() { .unwrap_or("false".to_string()) .to_lowercase(); let is_replay = !record_mode.eq("true") && !record_mode.eq("none"); + let concurrent_scenarios = match is_replay { + true => 16, + false => 1, + }; let parsed_cli: cli::Opts = cli::Opts::parsed(); let mut cucumber = DatadogWorld::cucumber() .with_default_cli() + .max_concurrent_scenarios(Some(concurrent_scenarios)) .repeat_failed() .fail_on_skipped() .before(move |feature, rule, scenario, world| { diff --git a/tests/scenarios/fixtures.rs b/tests/scenarios/fixtures.rs index 67ad2def9..dd4e5536d 100644 --- a/tests/scenarios/fixtures.rs +++ b/tests/scenarios/fixtures.rs @@ -218,11 +218,17 @@ pub async fn after_scenario( #[given(expr = "a valid \"apiKeyAuth\" key in the system")] fn valid_apikey_auth(world: &mut DatadogWorld) { world.config.api_key_auth = env::var("DD_TEST_CLIENT_API_KEY").ok(); + if let Some(api) = world.api_name.as_ref() { + initialize_api_instance(world, api.to_string()); + } } #[given(expr = "a valid \"appKeyAuth\" key in the system")] fn valid_appkey_auth(world: &mut DatadogWorld) { world.config.app_key_auth = env::var("DD_TEST_CLIENT_APP_KEY").ok(); + if let Some(api) = world.api_name.as_ref() { + initialize_api_instance(world, api.to_string()); + } } #[given(expr = "an instance of {string} API")]