Skip to content

Commit

Permalink
reinit api instance on config change
Browse files Browse the repository at this point in the history
  • Loading branch information
nkzou committed Feb 13, 2024
1 parent b5e7ae9 commit b33a677
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<parser::basic::Cli, runner::basic::Cli, writer::basic::Cli> =
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| {
Expand Down
6 changes: 6 additions & 0 deletions tests/scenarios/fixtures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit b33a677

Please sign in to comment.