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.

SSL

The flagd-testbed-ssl container is based on flagd-testbed but replaces all the certificates for SSL testing with a custom root CA. Within the SSL folder you will find all the necessary OpenSSL files, and the commands used for generation. Please do not use this CA in any kind of production environment.

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