Skip to content

feat: add @env-var tag to env-var config scenarios#359

Merged
aepfli merged 2 commits intomainfrom
feat/add-env-var-tag
Mar 31, 2026
Merged

feat: add @env-var tag to env-var config scenarios#359
aepfli merged 2 commits intomainfrom
feat/add-env-var-tag

Conversation

@aepfli
Copy link
Copy Markdown
Member

@aepfli aepfli commented Mar 31, 2026

Summary

Adds the @env-var tag to all config scenarios that mutate system environment variables via Given an environment variable ... with value ....

Motivation

SDKs that run Cucumber scenarios in parallel need a way to serialise scenarios that mutate global process state (environment variables). Cucumber's exclusive resource mechanism can lock on a tag, but only if the feature files actually carry that tag.

Without @env-var, parallel runners either:

  • disable parallelism for the entire config suite (wasteful), or
  • suffer from flaky env-var races (e.g. FLAGD_PORT=3456 leaking into a scenario expecting 8015).

Tagged scenarios

Scenario Tags added
Dedicated Config via Env_var @env-var
Dedicated Config via Env_var special In-process case @env-var (appended to existing)
Dedicated Config via Env_var special file case @env-var (appended to existing)
Dedicated Config via Env_var and set @env-var
FLAGD_SYNC_PORT takes priority over FLAGD_PORT @env-var (appended to existing)

Companion to: open-feature/java-sdk-contrib#1752

Tag all scenario outlines that mutate System environment variables so
the Cucumber exclusive-resources mechanism can serialise them during
parallel execution (ENV_VARS resource lock in junit-platform.properties).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli aepfli requested a review from a team as a code owner March 31, 2026 08:35
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the gherkin/config.feature file by adding the @env-var tag to several scenarios that manipulate environment variables. This is likely intended to facilitate resource locking or isolation during test execution. A review comment suggests extending this tag to scenarios that read default environment values to prevent potential race conditions and state leakage when tests are run concurrently.

@aepfli aepfli changed the title test: add @env-var tag to env-var config scenarios feat: add @env-var tag to env-var config scenarios Mar 31, 2026
@aepfli
Copy link
Copy Markdown
Member Author

aepfli commented Mar 31, 2026

Thanks for the review!

The @env-var tag intentionally only marks writer scenarios (those that mutate env vars). The tag exists so SDK implementations can use Cucumber's exclusive resource locking to serialise them when running scenarios in parallel.

In the Java SDK (the companion PR), we handle the config suite differently: ConfigCucumberTest disables parallel execution entirely (cucumber.execution.parallel.enabled=false), so all config scenarios — both readers and writers — already run sequentially. The env-var race described here cannot occur.

Tagging reader-only scenarios like "Default Config" with @env-var would be semantically misleading — they don't touch env vars — and would unnecessarily constrain other SDKs that might want finer-grained locking (e.g. read-write for writers vs read for readers in the future).

Add active TCP health checks (interval=1s) and reduce connect_timeout from
the default 5s to 0.25s on both flagd clusters (RPC port 8013, sync port 8015).

This ensures envoy detects and recovers from upstream flagd restarts within
one health-check cycle rather than waiting for a client-triggered connection
attempt. Combined with the shorter connect_timeout, failed connections are
detected and retried quickly rather than blocking for up to 5 seconds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli aepfli merged commit 7fb6fa1 into main Mar 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants