Skip to content

Commit bd86a10

Browse files
committed
test(flagd): isolate @env-var scenarios from concurrent config reads
@env-var scenarios mutate process-global environment variables (e.g. FLAGD_SYNC_PORT) that a concurrently-running config-default scenario reads at build() time, causing intermittent wrong-value assertions (e.g. in-process port resolving to 9999 instead of 8015). The existing ENV_VARS read-write lock only serialized @env-var scenarios against each other. Give every scenario in an engine a READ lock on ENV_VARS (keyed by its include tag); @env-var scenarios escalate to read-write, so they run exclusively while no other scenario in the engine reads config. Signed-off-by: Simon Schrottner <simon.schrottner@gmail.com>
1 parent 2f8afcf commit bd86a10

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e

providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunE2ETests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ private Stream<DynamicNode> resolverTests(String resolverGlue, String includeTag
101101
.configurationParameter("cucumber.execution.parallel.config.strategy", "dynamic")
102102
.configurationParameter("cucumber.execution.parallel.config.dynamic.factor", "1")
103103
.configurationParameter("cucumber.execution.exclusive-resources.env-var.read-write", "ENV_VARS")
104+
// Every scenario in this engine carries the include tag, so give them all a READ lock
105+
// on ENV_VARS. @env-var scenarios also declare read-write (above) which escalates to an
106+
// exclusive lock — so they run while no other scenario in this engine reads config,
107+
// preventing a process-global env var (e.g. FLAGD_SYNC_PORT) from leaking into a
108+
// concurrent config-default scenario.
109+
.configurationParameter("cucumber.execution.exclusive-resources." + includeTag + ".read", "ENV_VARS")
104110
.configurationParameter("cucumber.execution.exclusive-resources.grace.read-write", "CONTAINER_RESTART")
105111
.build();
106112

0 commit comments

Comments
 (0)