Skip to content

Shared test harness for flagd SDK testing, with Gherkin tests

Notifications You must be signed in to change notification settings

open-feature/flagd-testbed

Repository files navigation

OpenFeature Test Harness

This repository contains a docker image to support the gherkin suites in the OpenFeature specification.

flagd-testbed container

The flagd-testbed container is a docker image built on flagd, which essentially just adds a simple set of flags for the purposes of testing OpenFeature SDKs. testing-flags.json contains a set of flags consistent with the evaluation feature. change-flag.sh runs in the test container generates a file changing-flag.json, which contains a flag that changes once every seconds, allowing to easily test change events.

See the flagd docs for more information on flagd.

Gherkin test suite

The gherkin/ dir includes a set of gherkin tests that define expected behavior associated with the configurations defined in the flagd-testbed (see flags/). Combined with the flagd-provider for the associated SDK and the flagd-testbed, these comprise a complete integration test suite.

Included suites:

flagd.feature includes tests relevant to flagd and all flagd providers:

  • default value (zero-value) handling (some proto3 implementations handle these inconsistently).
  • basic event handling

flagd-json-evaluator.feature includes tests relevant to flagd and in-process providers:

  • custom JSONLogic operators (starts_with, ends_with, fractional, sem_ver)
  • evaluator reuse via $ref

Lint Gherkin files

The Gherkin files structure can be linted using gherkin-lint. The following commands require Node.js 10 or later.

  1. npm install
  2. npm run gherkin-lint