From 88eec8e3ee517b93ef0020f5ca6452465ad1f38e Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Tue, 5 Sep 2023 14:28:21 -0400 Subject: [PATCH] fixup: formating Signed-off-by: Todd Baert --- .gherkin-lintrc | 4 +++- README.md | 18 +++++++++++++++- gherkin/flagd.feature | 48 +++++++++++++++++++++---------------------- 3 files changed, 44 insertions(+), 26 deletions(-) diff --git a/.gherkin-lintrc b/.gherkin-lintrc index abe95f9..16d3030 100644 --- a/.gherkin-lintrc +++ b/.gherkin-lintrc @@ -14,7 +14,9 @@ "Feature": 0, "Background": 2, "Scenario": 2, - "Step": 4 + "Step": 4, + "Examples": 4, + "example": 6 } ], "no-trailing-spaces": "on", diff --git a/README.md b/README.md index b846640..8004d85 100644 --- a/README.md +++ b/README.md @@ -15,4 +15,20 @@ See the [flagd docs](https://flagd.dev/) for more information on flagd. The _sync_-testbed_ container is a docker image built on conforming to the sync.proto - a grpc which flagd or flagd in-process providers can use as a sync-source. It features an identical set of flags to the [flagd-testbed container](#flagd-testbed-container) -For details on the sync-testbed, see [sync/README.me](sync/README.md) \ No newline at end of file +For details on the sync-testbed, see [sync/README.me](sync/README.md) + +## Gherkin test suite + +The [gherkin/](gherkin/) dir includes a set of [_gherkin_](https://cucumber.io/docs/gherkin/) tests that define expected behavior associated with the configurations defined in the flagd-testbed (see [flags/](flags/)). +Combined with the _flagd-provider_ for the associated SDK and the flagd-testbed, these comprise a complete integration test suite. +They include tests for: +* default value (zero-value) handling (some proto3 implementations handle these inconsistently). +* basic event handling +* custom JSONLogic operators (`starts_with`, `ends_with`, `fractional`, `sem_ver`) + +### Lint Gherkin files + +The Gherkin files structure can be linted using [gherkin-lint](https://github.com/vsiakka/gherkin-lint). The following commands require Node.js 10 or later. + +1. npm install +1. npm run gherkin-lint \ No newline at end of file diff --git a/gherkin/flagd.feature b/gherkin/flagd.feature index c7ecde7..bd2b50e 100644 --- a/gherkin/flagd.feature +++ b/gherkin/flagd.feature @@ -1,9 +1,9 @@ Feature: flagd providers -# This test suite contains scenarios to test flagd providers (both RPC and in-process). -# It's associated with the flags configured in flags/custom-ops.json and flags/zero-flags.json -# It should be used in conjunection with the suites supplied by the OpenFeature specification - + # This test suite contains scenarios to test flagd providers (both RPC and in-process). + # It's associated with the flags configured in flags/custom-ops.json and flags/zero-flags.json + # It should be used in conjunection with the suites supplied by the OpenFeature specification + Background: Given a flagd provider is set @@ -41,41 +41,41 @@ Feature: flagd providers And a context containing a nested property with outer key "user" and inner key "name", with value Then the returned value should be Examples: - |name|value| - |jack|clubs| - |queen|diamonds| - |ace|hearts| - |joker|spades| + | name | value | + | jack | clubs | + | queen | diamonds | + | ace | hearts | + | joker | spades | Scenario Outline: Substring operators When a string flag with key "starts-ends-flag" is evaluated with default value "fallback" And a context containing a key "id", with value Then the returned value should be Examples: - |id|value| - |abcdef|prefix| - |uvwxyz|postfix| - |abcxyz|prefix| - |lmnopq|nomatch| + | id | value | + | abcdef | prefix | + | uvwxyz | postfix | + | abcxyz | prefix | + | lmnopq | nomatch | Scenario Outline: Semantic version operator numeric comparision When a string flag with key "equal-greater-lesser-version-flag" is evaluated with default value "fallback" And a context containing a key "version", with value Then the returned value should be Examples: - |version|value| - |2.0.0|equal| - |2.1.0|greater| - |1.9.0|lesser| - |2.0.0-alpha|lesser| - |2.0.0.0|invalid| + | version | value | + | 2.0.0 | equal | + | 2.1.0 | greater | + | 1.9.0 | lesser | + | 2.0.0-alpha | lesser | + | 2.0.0.0 | invalid | Scenario Outline: Semantic version operator semantic comparision When a string flag with key "major-minor-version-flag" is evaluated with default value "fallback" And a context containing a key "version", with value Then the returned value should be Examples: - |version|value| - |3.0.1|minor| - |3.1.0|major| - |4.0.0|none| \ No newline at end of file + | version | value | + | 3.0.1 | minor | + | 3.1.0 | major | + | 4.0.0 | none |