This repository contains a Docker image and flagd's Provider TCK extension scenarios, which flagd providers run to check their behaviour.
The flagd-testbed container is a Docker image that includes flagd and a testing utility called launchpad.
It provides a simple way to run end-to-end (E2E) tests across multiple SDKs.
Launchpad is a control center for managing flagd during tests. It exposes a REST interface that allows you to:
- Start, stop, or restart flagd
- Dynamically update a single flag, simulating real-time flag changes
This approach centralizes the test orchestration logic, reducing the need to replicate it across SDKs in multiple languages. This simplifies test implementation and allows contributors to focus on testing behavior rather than setup.
Detailed usage and API documentation can be found in the Launchpad README.
Flagd configurations are stored in the launchpad/configs directory.
Each file corresponds to a named configuration and can be passed as a parameter to the start endpoint.
Configurations may include different types of flagd setups and flag files.
Configured flag definitions reside in the flags directory.
Within the Docker image:
- The contents of this directory are mounted under
/rawflags - A generated file,
/flags/allFlags.json, aggregates all flag files excluding those prefixed withselector
This file is generated when flagd is started and can be used to test all flags in file mode simultaneously.
The tck-extensions directory holds flagd's scenarios as extensions for the
OpenFeature Provider TCK: a flagd provider runs
them alongside the TCK's own scenarios, against the image above. Its
README covers the tags, the extension steps and how to consume it.
The legacy gherkin/ suite was removed in 4.0. SDKs that still run it pin a 3.x release, which
keeps being cut from the release/v3
branch.
This repository should be included as a submodule within your sdk which should be tested.
We recommend:
- to setup renovate to automatically update your submodule, always pointing to version tags and not branches
- to load all extension feature files, and eliminate tests via tag exclusions
- to utilize testcontainers for easier test setup
- to use the version.txt within this repository to load the appropriate docker image
Go suites can skip the submodule entirely: this repository is also a Go module that embeds the compose stack, the TCK extension scenarios, the flag definitions and the test root certificate.
go get github.com/open-feature/flagd-testbed/v4The module has no dependencies of its own, so it does not constrain the testcontainers or Cucumber versions of the suite consuming it.
// Compose runners need the stack on disk.
dir := t.TempDir()
composePath, err := testbed.Materialize(dir)
// Scenarios do not - godog reads them straight from the embedded FS.
godog.TestSuite{Options: &godog.Options{FS: testbed.TCKExtensions(), Paths: []string{"."}}}The compose file defaults to the flagd-testbed image of the release it was taken from,
so the assets and the image are pinned by the single go.mod entry, and renovate updates
them like any other Go dependency. The module path carries the /v4 major suffix Go
requires from v2 on, so it changes with every major release.
| Branch | Line | Releases | :latest |
|---|---|---|---|
main |
4.x, in beta | v4.0.0-beta.N pre-releases until 4.0.0 is declared stable |
not moved by betas |
release/v3 |
3.x | v3.x releases for SDKs still on gherkin/ |
stays on the last 3.x until 4.0.0 |
New scenarios go to main. A fix the 3.x line needs goes to release/v3, or is cherry-picked there.
The flagd-testbed Docker image can be built from the Dockerfile located at flagd/Dockerfile.
To build the image with the default flagd base image:
docker build -f flagd/Dockerfile -t flagd-testbed:latest --target testbed .You can specify a custom flagd base image using the FLAGD_BASE_IMAGE build argument. This is useful when testing with pipeline-built or custom flagd images:
docker build -f flagd/Dockerfile \
--build-arg FLAGD_BASE_IMAGE=ghcr.io/open-feature/flagd:custom-tag \
-t flagd-testbed:custom --target testbed .Examples:
# Using a specific flagd version
docker build -f flagd/Dockerfile \
--build-arg FLAGD_BASE_IMAGE=ghcr.io/open-feature/flagd:v0.13.0 \
-t flagd-testbed:v0.13.0 --target testbed .
# Using a locally built flagd image
docker build -f flagd/Dockerfile \
--build-arg FLAGD_BASE_IMAGE=my-custom-flagd:latest \
-t flagd-testbed:dev --target testbed .If the FLAGD_BASE_IMAGE argument is not provided, the build defaults to ghcr.io/open-feature/flagd:v0.12.9 to maintain backwards compatibility.
You can lint the Gherkin file structure using gherkin-lint. Requires Node.js v10+.
npm install
npm run gherkin-lint