From 3c81d92878b3a719a69244a2abf09ea7b3dcb2db Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Tue, 20 Oct 2026 09:27:02 +0200 Subject: [PATCH 1/3] test(go-feature-flag): adopt the OpenFeature Provider TCK Runs the conformance suite against the GO Feature Flag provider in both evaluation types, in-process (WASM) and remote (OFREP), against the aepfli/goff-tck-testbed 0.1.0 image. The first run declares every declarable capability; withholding and deviations follow from results. Part of open-feature/spec#417. Signed-off-by: Simon Schrottner --- providers/go-feature-flag/pom.xml | 14 +++ .../tck/AbstractGoFeatureFlagTest.java | 104 ++++++++++++++++++ .../gofeatureflag/tck/InProcessTest.java | 17 +++ .../gofeatureflag/tck/RemoteTest.java | 17 +++ .../test/resources/tck/docker-compose.yaml | 16 +++ 5 files changed, 168 insertions(+) create mode 100644 providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java create mode 100644 providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java create mode 100644 providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java create mode 100644 providers/go-feature-flag/src/test/resources/tck/docker-compose.yaml diff --git a/providers/go-feature-flag/pom.xml b/providers/go-feature-flag/pom.xml index d2e52e7fee..499247c3b9 100644 --- a/providers/go-feature-flag/pom.xml +++ b/providers/go-feature-flag/pom.xml @@ -23,6 +23,8 @@ 0.2.4 **/e2e/*.java + + [0.1.0,) @@ -112,6 +114,18 @@ test + + + dev.openfeature.contrib.tools + tck + ${tck.version} + test + + org.testcontainers testcontainers-junit-jupiter diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java new file mode 100644 index 0000000000..59b3f6c358 --- /dev/null +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java @@ -0,0 +1,104 @@ +package dev.openfeature.contrib.providers.gofeatureflag.tck; + +import dev.openfeature.contrib.providers.gofeatureflag.GoFeatureFlagProvider; +import dev.openfeature.contrib.providers.gofeatureflag.GoFeatureFlagProviderOptions; +import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; +import dev.openfeature.contrib.providers.gofeatureflag.exception.InvalidOptions; +import dev.openfeature.contrib.tools.tck.BackendEndpoint; +import dev.openfeature.contrib.tools.tck.Capability; +import dev.openfeature.contrib.tools.tck.ContainerizedProviderTckTest; +import dev.openfeature.contrib.tools.tck.KnownDeviation; +import dev.openfeature.sdk.FeatureProvider; +import java.io.File; +import java.util.Collections; +import java.util.List; +import java.util.Set; + +/** + * Shared configuration for running the OpenFeature Provider TCK against the GO Feature Flag + * provider. + * + *

The provider evaluates in two quite different ways, and both are worth conforming: in-process + * pulls the flag configuration from the relay proxy and evaluates it in a WASM build of the GO + * Feature Flag engine, while remote asks the relay proxy over OFREP. They share a backend and differ + * only in evaluation type, so the modes are two small subclasses. + * + *

The backend is aepfli/goff-tck-testbed: + * the unmodified relay proxy, with a launchpad implementing the control API that writes its flag + * file and forces a retriever refresh. + */ +abstract class AbstractGoFeatureFlagTest extends ContainerizedProviderTckTest { + + /** The relay proxy's container-internal port, serving both evaluation types. */ + private static final int RELAY_PROXY_PORT = 1031; + + /** + * A port nothing listens on, for the initialisation-failure scenarios. + * + *

Deliberately not a port on the Compose stack: the stack must stay up for the whole suite, + * and simulated outages belong to the control API. + */ + private static final int UNAVAILABLE_PORT = 9999; + + /** + * How often the in-process evaluator polls the relay proxy for a changed configuration. + * + *

Lowered from the two-minute default, against which no event scenario can complete. Remote + * evaluation ignores it. + */ + private static final long FLAG_CHANGE_POLLING_INTERVAL_MS = 500; + + /** The evaluation type under test. */ + protected abstract EvaluationType evaluationType(); + + @Override + public File composeFile() { + return new File("src/test/resources/tck/docker-compose.yaml"); + } + + @Override + public List backendPorts() { + return Collections.singletonList(RELAY_PROXY_PORT); + } + + @Override + public FeatureProvider createProvider(BackendEndpoint endpoint) { + return provider(String.format("http://%s:%d/", endpoint.host(), endpoint.port(RELAY_PROXY_PORT))); + } + + @Override + public FeatureProvider createUnavailableProvider() { + return provider(String.format("http://localhost:%d/", UNAVAILABLE_PORT)); + } + + /** + * {@inheritDoc} + * + *

Everything declarable, on this first run. Which capabilities to withhold, and which failures + * to record as deviations, is decided per scenario from the results rather than predicted. + */ + @Override + public Set capabilities() { + return Capability.declarable(); + } + + @Override + public List knownDeviations() { + return Collections.emptyList(); + } + + private FeatureProvider provider(String endpoint) { + try { + return new GoFeatureFlagProvider(GoFeatureFlagProviderOptions.builder() + .endpoint(endpoint) + .evaluationType(evaluationType()) + .flagChangePollingIntervalMs(FLAG_CHANGE_POLLING_INTERVAL_MS) + // The data collector is not part of the provider contract, and its background + // flushes would only add traffic to the backend under test. + .disableDataCollection(true) + .build()); + } catch (InvalidOptions e) { + throw new IllegalStateException("invalid GO Feature Flag provider options", e); + } + } +} diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java new file mode 100644 index 0000000000..bc8ad16e04 --- /dev/null +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java @@ -0,0 +1,17 @@ +package dev.openfeature.contrib.providers.gofeatureflag.tck; + +import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; + +/** Runs the OpenFeature Provider TCK against the GO Feature Flag provider in in-process mode. */ +public class InProcessTest extends AbstractGoFeatureFlagTest { + + @Override + public String configuration() { + return "go-feature-flag-in-process"; + } + + @Override + protected EvaluationType evaluationType() { + return EvaluationType.IN_PROCESS; + } +} diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java new file mode 100644 index 0000000000..d8d05280d0 --- /dev/null +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java @@ -0,0 +1,17 @@ +package dev.openfeature.contrib.providers.gofeatureflag.tck; + +import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; + +/** Runs the OpenFeature Provider TCK against the GO Feature Flag provider in remote (OFREP) mode. */ +public class RemoteTest extends AbstractGoFeatureFlagTest { + + @Override + public String configuration() { + return "go-feature-flag-remote"; + } + + @Override + protected EvaluationType evaluationType() { + return EvaluationType.REMOTE; + } +} diff --git a/providers/go-feature-flag/src/test/resources/tck/docker-compose.yaml b/providers/go-feature-flag/src/test/resources/tck/docker-compose.yaml new file mode 100644 index 0000000000..714e84d689 --- /dev/null +++ b/providers/go-feature-flag/src/test/resources/tck/docker-compose.yaml @@ -0,0 +1,16 @@ +# The GO Feature Flag provider-TCK backend: the relay proxy with a launchpad implementing the +# control API. https://github.com/aepfli/goff-tck-testbed +# +# The service is named "backend" because that is ContainerizedProviderTckTest's default. +# +# The image is PINNED, not :latest, so a push to the testbed cannot change this adoption's results +# with no diff here to explain it. +# +# Ports are never pinned. The TCK reads the dynamically mapped host ports after the stack is up, +# and POST /stop never restarts the container precisely so those mappings survive an outage. +services: + backend: + image: ${GOFF_TESTBED_IMAGE:-ghcr.io/aepfli/goff-tck-testbed:0.1.0} + ports: + - 1031 # relay proxy -- what the provider under test talks to + - 8080 # launchpad -- control API From 64a35c598ec47c5a420e52fdf11f3d2626026a04 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Tue, 20 Oct 2026 09:32:17 +0200 Subject: [PATCH 2/3] test(go-feature-flag): declare per mode from the first TCK run In-process passes 64 of 65 with everything declarable; the skip is @large-integers, refused for Java. Remote is the OFREP provider underneath and withholds what it does not attempt (@stale, @configuration-change, @unavailable, @numeric-coercion). It declares @disabled-flags and fails it, tracked as java-sdk-contrib#1850. Signed-off-by: Simon Schrottner --- .../tck/AbstractGoFeatureFlagTest.java | 19 ------ .../gofeatureflag/tck/InProcessTest.java | 28 ++++++++ .../gofeatureflag/tck/RemoteTest.java | 64 ++++++++++++++++++- 3 files changed, 91 insertions(+), 20 deletions(-) diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java index 59b3f6c358..250c76fdec 100644 --- a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/AbstractGoFeatureFlagTest.java @@ -5,14 +5,11 @@ import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; import dev.openfeature.contrib.providers.gofeatureflag.exception.InvalidOptions; import dev.openfeature.contrib.tools.tck.BackendEndpoint; -import dev.openfeature.contrib.tools.tck.Capability; import dev.openfeature.contrib.tools.tck.ContainerizedProviderTckTest; -import dev.openfeature.contrib.tools.tck.KnownDeviation; import dev.openfeature.sdk.FeatureProvider; import java.io.File; import java.util.Collections; import java.util.List; -import java.util.Set; /** * Shared configuration for running the OpenFeature Provider TCK against the GO Feature Flag @@ -71,22 +68,6 @@ public FeatureProvider createUnavailableProvider() { return provider(String.format("http://localhost:%d/", UNAVAILABLE_PORT)); } - /** - * {@inheritDoc} - * - *

Everything declarable, on this first run. Which capabilities to withhold, and which failures - * to record as deviations, is decided per scenario from the results rather than predicted. - */ - @Override - public Set capabilities() { - return Capability.declarable(); - } - - @Override - public List knownDeviations() { - return Collections.emptyList(); - } - private FeatureProvider provider(String endpoint) { try { return new GoFeatureFlagProvider(GoFeatureFlagProviderOptions.builder() diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java index bc8ad16e04..429448365e 100644 --- a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/InProcessTest.java @@ -1,6 +1,11 @@ package dev.openfeature.contrib.providers.gofeatureflag.tck; import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; +import dev.openfeature.contrib.tools.tck.Capability; +import dev.openfeature.contrib.tools.tck.KnownDeviation; +import java.util.Collections; +import java.util.List; +import java.util.Set; /** Runs the OpenFeature Provider TCK against the GO Feature Flag provider in in-process mode. */ public class InProcessTest extends AbstractGoFeatureFlagTest { @@ -14,4 +19,27 @@ public String configuration() { protected EvaluationType evaluationType() { return EvaluationType.IN_PROCESS; } + + /** + * {@inheritDoc} + * + *

Everything declarable, and measured: 65 scenarios, 64 passing, and the one skip is + * {@code @large-integers}, which the TCK refuses for every Java provider because the integer + * accessor is 32-bit. + * + *

{@link Capability#NUMERIC_COERCION} passes in full, which is worth stating because the GO + * Feature Flag engine itself narrows any float to an integer on an integer request. The WASM build + * evaluates untyped here and this provider type-checks the result, so {@code float-flag} asked for + * as an integer reports {@code TYPE_MISMATCH} rather than {@code 0}. The lossless integral-float + * scenario passes without asserting much: the relay proxy serves {@code 10.0} as {@code 10}. + */ + @Override + public Set capabilities() { + return Capability.declarable(); + } + + @Override + public List knownDeviations() { + return Collections.emptyList(); + } } diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java index d8d05280d0..cb90840067 100644 --- a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java @@ -1,8 +1,18 @@ package dev.openfeature.contrib.providers.gofeatureflag.tck; import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; +import dev.openfeature.contrib.tools.tck.Capability; +import dev.openfeature.contrib.tools.tck.KnownDeviation; +import java.util.Collections; +import java.util.List; +import java.util.Set; -/** Runs the OpenFeature Provider TCK against the GO Feature Flag provider in remote (OFREP) mode. */ +/** + * Runs the OpenFeature Provider TCK against the GO Feature Flag provider in remote mode. + * + *

Remote evaluation is the OFREP provider underneath ({@code RemoteEvaluator} wraps + * {@code OfrepProvider}), so its declarations follow the OFREP adoption's, and for the same reasons. + */ public class RemoteTest extends AbstractGoFeatureFlagTest { @Override @@ -14,4 +24,56 @@ public String configuration() { protected EvaluationType evaluationType() { return EvaluationType.REMOTE; } + + /** + * {@inheritDoc} + * + *

Withheld, each because this mode does not attempt it, and each measured as failing when + * declared: + * + *

    + *
  • {@link Capability#STALE} and {@link Capability#CONFIGURATION_CHANGE} — the + * only outbound call is the per-evaluation OFREP request. Nothing polls, so a change or an + * outage is never observed as an event. + *
  • {@link Capability#UNAVAILABLE_INIT} — {@code RemoteEvaluator.initialize} only + * initialises the OFREP provider, which never contacts the backend, so a provider pointed + * at a dead port reaches {@code READY}. + *
  • {@link Capability#NUMERIC_COERCION} — OFREP carries no type, and the OFREP + * provider admits a value only on an exact instance check, so {@code integer-flag} asked + * for as a float returns the code default. Strict numeric typing is a legitimate choice, + * so no deviation. The in-process mode of this same provider does widen. + *
+ * + *

{@link Capability#DISABLED_FLAGS} is declared and fails, see {@link #knownDeviations()}. + */ + @Override + public Set capabilities() { + return Capability.declarableExcept( + Capability.STALE, + Capability.CONFIGURATION_CHANGE, + Capability.UNAVAILABLE_INIT, + Capability.NUMERIC_COERCION); + } + + /** + * {@inheritDoc} + * + *

Declared and failing, the shape Appendix F prefers: the relay proxy answers a disabled flag + * with reason {@code DISABLED} and no value, OFREP's {@code codeDefaultFlag}, and the OFREP + * provider reports that as {@code FLAG_NOT_FOUND}. All five disabled-flag scenarios fail on the + * error code or reason, never on the value. Delete with the declaration's failure once + * java-sdk-contrib#1850 is fixed. + */ + @Override + public List knownDeviations() { + return Collections.singletonList(KnownDeviation.tracked( + Capability.DISABLED_FLAGS, + "https://github.com/open-feature/java-sdk-contrib/issues/1850", + "A value-less OFREP evaluation success is reported as FLAG_NOT_FOUND. The relay " + + "proxy answers a disabled flag with reason DISABLED and no value, which is " + + "OFREP's codeDefaultFlag; the OFREP provider this mode delegates to treats " + + "the missing value as an absent flag and drops the reason. The value " + + "returned is the code default, as it should be; the error code and reason " + + "are wrong. The in-process mode of the same provider reports DISABLED.")); + } } From 73aba5efa6ed5eade52bae1be39c1bb780e2dff7 Mon Sep 17 00:00:00 2001 From: Simon Schrottner Date: Mon, 2 Nov 2026 20:19:07 +0100 Subject: [PATCH 3/3] test(go-feature-flag): withhold @disabled-flags in remote mode The OFREP provider that remote mode delegates to reports a value-less disabled flag as FLAG_NOT_FOUND (#1850). Withhold the capability until that is fixed instead of declaring it and failing; drop the matching deviation. Signed-off-by: Simon Schrottner --- .../gofeatureflag/tck/RemoteTest.java | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java index cb90840067..e2584d41e5 100644 --- a/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java +++ b/providers/go-feature-flag/src/test/java/dev/openfeature/contrib/providers/gofeatureflag/tck/RemoteTest.java @@ -2,9 +2,6 @@ import dev.openfeature.contrib.providers.gofeatureflag.bean.EvaluationType; import dev.openfeature.contrib.tools.tck.Capability; -import dev.openfeature.contrib.tools.tck.KnownDeviation; -import java.util.Collections; -import java.util.List; import java.util.Set; /** @@ -42,9 +39,12 @@ protected EvaluationType evaluationType() { * provider admits a value only on an exact instance check, so {@code integer-flag} asked * for as a float returns the code default. Strict numeric typing is a legitimate choice, * so no deviation. The in-process mode of this same provider does widen. + *

  • {@link Capability#DISABLED_FLAGS} — the relay proxy answers a disabled flag with + * reason {@code DISABLED} and no value, OFREP's {@code codeDefaultFlag}, and the OFREP + * provider reports that as {@code FLAG_NOT_FOUND}, dropping the reason + * (java-sdk-contrib#1850). The value is the code default either way. Declare it again once + * that is fixed; the in-process mode of this same provider reports {@code DISABLED}. * - * - *

    {@link Capability#DISABLED_FLAGS} is declared and fails, see {@link #knownDeviations()}. */ @Override public Set capabilities() { @@ -52,28 +52,7 @@ public Set capabilities() { Capability.STALE, Capability.CONFIGURATION_CHANGE, Capability.UNAVAILABLE_INIT, - Capability.NUMERIC_COERCION); - } - - /** - * {@inheritDoc} - * - *

    Declared and failing, the shape Appendix F prefers: the relay proxy answers a disabled flag - * with reason {@code DISABLED} and no value, OFREP's {@code codeDefaultFlag}, and the OFREP - * provider reports that as {@code FLAG_NOT_FOUND}. All five disabled-flag scenarios fail on the - * error code or reason, never on the value. Delete with the declaration's failure once - * java-sdk-contrib#1850 is fixed. - */ - @Override - public List knownDeviations() { - return Collections.singletonList(KnownDeviation.tracked( - Capability.DISABLED_FLAGS, - "https://github.com/open-feature/java-sdk-contrib/issues/1850", - "A value-less OFREP evaluation success is reported as FLAG_NOT_FOUND. The relay " - + "proxy answers a disabled flag with reason DISABLED and no value, which is " - + "OFREP's codeDefaultFlag; the OFREP provider this mode delegates to treats " - + "the missing value as an absent flag and drops the reason. The value " - + "returned is the code default, as it should be; the error code and reason " - + "are wrong. The in-process mode of the same provider reports DISABLED.")); + Capability.NUMERIC_COERCION, + Capability.DISABLED_FLAGS); } }