Skip to content

Commit

Permalink
Merge branch 'main' into feat/improve_gherkin
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Schrottner <[email protected]>
  • Loading branch information
aepfli committed Dec 27, 2024
2 parents 796c0e8 + 706a7e9 commit 6804205
Show file tree
Hide file tree
Showing 14 changed files with 224 additions and 26 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ jobs:
with:
context: .
file: flagd/Dockerfile
target: testbed
push: false

- name: Build flagd-testbed-unstable Docker image
uses: docker/build-push-action@v6
with:
context: .
file: flagd/Dockerfile.unstable
file: flagd/Dockerfile
target: unstable
push: false

- name: Build flagd-testbed-ssl Docker image
uses: docker/build-push-action@v6
with:
context: .
file: flagd/Dockerfile
target: ssl
push: false
16 changes: 14 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
with:
context: .
file: flagd/Dockerfile
target: testbed
push: true
tags: |
${{ env.REGISTRY }}/open-feature/${{ env.FLAGD_IMAGE_NAME }}:${{ needs.release-please.outputs.release_tag_name }}
Expand All @@ -68,12 +69,23 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: flagd/Dockerfile.unstable
file: flagd/Dockerfile
target: unstable
push: true
tags: |
${{ env.REGISTRY }}/open-feature/${{ env.FLAGD_IMAGE_NAME }}-unstable:${{ needs.release-please.outputs.release_tag_name }}
${{ env.REGISTRY }}/open-feature/${{ env.FLAGD_IMAGE_NAME }}-unstable:latest
${{ env.REGISTRY }}/open-feature/${{ env.SYNC_IMAGE_NAME }}:${{ needs.release-please.outputs.release_tag_name }}
${{ env.REGISTRY }}/open-feature/${{ env.SYNC_IMAGE_NAME }}:latest
- name: Build and push flagd-testbed-ssl Docker image
uses: docker/build-push-action@v6
with:
context: .
file: flagd/Dockerfile
target: ssl
push: true
tags: |
${{ env.REGISTRY }}/open-feature/${{ env.FLAGD_IMAGE_NAME }}-ssl:${{ needs.release-please.outputs.release_tag_name }}
${{ env.REGISTRY }}/open-feature/${{ env.FLAGD_IMAGE_NAME }}-ssl:latest
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.5.17"
".": "0.5.20"
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## [0.5.20](https://github.com/open-feature/flagd-testbed/compare/v0.5.19...v0.5.20) (2024-12-25)


### Features

* move to grace period from grace attempts ([#172](https://github.com/open-feature/flagd-testbed/issues/172)) ([56a600f](https://github.com/open-feature/flagd-testbed/commit/56a600fd0f9bcdcc435ac41ed02edcf832a01b3c))

## [0.5.19](https://github.com/open-feature/flagd-testbed/compare/v0.5.18...v0.5.19) (2024-12-17)


### Features

* add certificates for ssl test and an ssl test image ([#168](https://github.com/open-feature/flagd-testbed/issues/168)) ([8177dc0](https://github.com/open-feature/flagd-testbed/commit/8177dc0c4bde7ddadb5a939f55ee70663ca485b9))

## [0.5.18](https://github.com/open-feature/flagd-testbed/compare/v0.5.17...v0.5.18) (2024-12-16)


### Features

* add yaml file with current version, to easier fetch images corr… ([#169](https://github.com/open-feature/flagd-testbed/issues/169)) ([ac1263a](https://github.com/open-feature/flagd-testbed/commit/ac1263af53f3d9380bfe4732034f4282f9a93228))

## [0.5.17](https://github.com/open-feature/flagd-testbed/compare/v0.5.16...v0.5.17) (2024-12-06)


Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ The _flagd-testbed_ container is a docker image built on flagd, which essentiall

See the [flagd docs](https://flagd.dev/) 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/](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/)).
Expand All @@ -31,4 +37,5 @@ Included suites:
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
1. npm run gherkin-lint

32 changes: 30 additions & 2 deletions flagd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# we NEED flagd v0.6.4 as a minimum
FROM ghcr.io/open-feature/flagd:v0.11.4 AS flagd
FROM ghcr.io/open-feature/flagd:v0.11.5 AS flagd

FROM busybox:1.37
FROM busybox:1.37 AS testbed

COPY --from=flagd /flagd-build /flagd
COPY flags/* .
Expand All @@ -15,3 +15,31 @@ ENTRYPOINT ["sh", "change-flag-wrapper.sh", "./flagd", "start", \
"-f", "file:evaluator-refs.json", \
"-f", "file:edge-case-flags.json", \
"-f", "file:zero-flags.json"]

FROM testbed AS unstable

ENTRYPOINT ["sh", "restart-wrapper.sh", "./flagd", "start", \
"-f", "file:testing-flags.json"]

FROM alpine/openssl AS certs

# Copy the server and CA certificates
COPY ssl/* ./

RUN openssl genpkey -algorithm RSA -out server-key.pem -pkeyopt rsa_keygen_bits:2048
RUN openssl req -new -key server-key.pem -out server.csr -subj "/CN=localhost" \
&& openssl x509 -req -in server.csr -CA custom-root-cert.crt -CAkey custom-ca.key -CAcreateserial -out server-cert.pem -days 365 -sha256

FROM testbed AS ssl

# Copy the custom root CA certificate into the image

COPY --from=certs server-cert.pem /etc/ssl/certs/
COPY --from=certs server-key.pem /etc/ssl/private/
COPY --from=certs custom-root-cert.crt /etc/ssl/certs/


ENTRYPOINT ["./flagd", "start",\
"-f", "file:testing-flags.json", \
"-c", "/etc/ssl/certs/server-cert.pem", \
"-k", "/etc/ssl/private/server-key.pem"]
12 changes: 0 additions & 12 deletions flagd/Dockerfile.unstable

This file was deleted.

2 changes: 1 addition & 1 deletion gherkin/config.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Configuration Test
| streamDeadlineMs | FLAGD_STREAM_DEADLINE_MS | deadline for streaming calls, useful as an application-layer keepalive | int | 600000 | rpc & in-process |
| retryBackoffMs | FLAGD_RETRY_BACKOFF_MS | initial backoff for stream retry | int | 1000 | rpc & in-process |
| retryBackoffMaxMs | FLAGD_RETRY_BACKOFF_MAX_MS | maximum backoff for stream retry | int | 120000 | rpc & in-process |
| retryGracePeriod | FLAGD_RETRY_GRACE_PERIOD | amount of stream retry attempts before provider moves from STALE to ERROR state | int | 5 | rpc & in-process |
| retryGracePeriod | FLAGD_RETRY_GRACE_PERIOD | time before provider moves from STALE to ERROR state | int | 5 | rpc & in-process |
| keepAliveTime | FLAGD_KEEP_ALIVE_TIME_MS | http 2 keepalive | long | 0 | rpc & in-process |
| cache | FLAGD_CACHE | enable cache of static flags | String - `lru`, `disabled` | lru | rpc |
| maxCacheSize | FLAGD_MAX_CACHE_SIZE | max size of static flag cache | int | 1000 | rpc |
Expand Down
49 changes: 44 additions & 5 deletions gherkin/flagd-reconnect.feature
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
@rpc @in-process @reconnect
@rpc @in-process
Feature: flagd provider disconnect and reconnect functionality

Scenario Outline: Connection
Given a <name> flagd provider
And a Boolean-flag with key "boolean-flag" and a default value "true"
When the flag was evaluated with details
Then the resolved details value should be "true"

Examples: Stable
| name |
| stable |
@targetURI
Examples: Target URI
| name |
| target |
@customCert
Examples: Certificates
| name |
| ssl |
@unixsocket @os.linux
Examples: Unixsocket
| name |
| socket |

@reconnect
# This test suite tests the reconnection functionality of flagd providers
Scenario: Provider reconnection
Given a stable flagd provider
Scenario Outline: Provider reconnection
Given a <name> flagd provider
And a ready event handler
And a error event handler
When a ready event was fired
Then the ready event handler should have been executed
When the connection is lost for 6s
When the connection is lost for 4s
Then the error event handler should have been executed
Then the ready event handler should have been executed

Examples: Stable
| name |
| stable |
@targetURI
Examples: Target URI
| name |
| socket |
@customCert
Examples: Certificates
| name |
| ssl |
@unixsocket @os.linux
Examples: Unixsocket
| name |
| socket |


Scenario: Provider unavailable
Given an option "deadlineMs" of type "Integer" with value "1000"
And a unavailable flagd provider
Expand Down
2 changes: 1 addition & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
"bump-patch-for-minor-pre-major": true
}
}
}
}
10 changes: 10 additions & 0 deletions ssl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
commands used to generate the cert

```shell
# generating custom ca
openssl genpkey -algorithm RSA -out custom-ca.key -pkeyopt rsa_keygen_bits:4096

# generating root cert
openssl req -x509 -new -key custom-ca.key -out custom-root-cert.crt -days 3650 -sha256 -subj "/CN=Flagd testbed ROOT CA"

```
52 changes: 52 additions & 0 deletions ssl/custom-ca.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDQYbJXuYOPP1/m
4+Zewb71MX0rqQmBWx03/p2InTkgA80py1OhrdAb67BFcYueq3zmWAgvZHbyS8aj
NJqhLsFA7peuqffB1k2iprjkjJjMcCUOGXGnWdDG+8/lmFnUIEdz65eKixvZc5Vd
QWy0vFjhIpu2ueP2x9wVstNdVWR3FOdZ30xkCu26X1mBen1zLtfyoVp/Vq0PaSLa
mqft/kLq8nruCDvLFctuArP/cq/1nC1UekUwuacOvCuSJfRmOPd3OKj3558RIPiK
fdcEjoMxG827716MkWJRpaO+nN0repg2bi8usLP2xUIg7szuGijNcEWhFM75zThl
XCgMEZYnDPGNnI6HeZG+Do2UPu/g+sAJQt+VTo707l2auL9ubvVJejOj5LJqtMyr
qvX0XIFDEEt14kyK8fVSvIuW3tMZXsSSZA+Gzuvl5Tgc2UgEfbB8ERO1MRyBZHMR
/TDbe66x/x3lleVrqmrbSRBWpgNtDET5T9sJ1FZTjhf3qKOs6v22ppMfs9pS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pLClXTbRMuKg6fJ7I2FMHMdh0M5wFLK2ykjRGncE+9D3SEZ7JudfMIIjs
ie+919aLof0wS721MEkCkVjLSWoKgbIxtB10B7SKjbS2PD7Y2JhXzCUd98jZwxX3
W4sCggEBAI1V8FkHNPaw89Cd2rhpxLk+k6pQr8K6pqUJGxIJPXQdhE0dNkUb5UDi
8ZxQk34wnjrV68XAxcF1Ee1dtqSPiz9YQu3TAglXbktpLcNM33RWRJ0l66NYTLtI
1cTpZK7NPKy3MAtAN5yo3Ar24kBrPOaY4xD7rXxJb4Q/3+cOyN97T8CjoWefS4L5
RcoXlrgbf2O4i8xds7mDZjzyB5Si8S9E4z7iUwXFAg3EAuYR6ln8zftggz8RT7kI
yiWq6gc9AvsB27BE3h1ncsS2lMwfuT9C7bSHO8RSsn3LTZ2lbiBWF3OBaDoC2e71
adBbftlaZFzSZgw976uIBJEyeHw2sgs=
-----END PRIVATE KEY-----
30 changes: 30 additions & 0 deletions ssl/custom-root-cert.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFITCCAwmgAwIBAgIUWs226ZOg6QZpwL7sdah6owpAnEYwDQYJKoZIhvcNAQEL
BQAwIDEeMBwGA1UEAwwVRmxhZ2QgdGVzdGJlZCBST09UIENBMB4XDTI0MTIxNjE4
NDQyNFoXDTM0MTIxNDE4NDQyNFowIDEeMBwGA1UEAwwVRmxhZ2QgdGVzdGJlZCBS
T09UIENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0GGyV7mDjz9f
5uPmXsG+9TF9K6kJgVsdN/6diJ05IAPNKctToa3QG+uwRXGLnqt85lgIL2R28kvG
ozSaoS7BQO6Xrqn3wdZNoqa45IyYzHAlDhlxp1nQxvvP5ZhZ1CBHc+uXiosb2XOV
XUFstLxY4SKbtrnj9sfcFbLTXVVkdxTnWd9MZArtul9ZgXp9cy7X8qFaf1atD2ki
2pqn7f5C6vJ67gg7yxXLbgKz/3Kv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ERQwmaCQrK9EVRpB/1ifimbEBPnjp3cHJsA7ikkanMxmtLkyLemb52K3ZglUr
6m0HPjciXd/wEV4zUaZeeInN32qHJjt4fMJl4UvIv6m/sMTnxp4My2e/LOiqvp18
9A9s6D5JP+pQuIJFywU3quNsIe1Q8eLigJlEWHlkSRFoWO3qvr0Da/8sTDLfEaOv
1RjlE6tZkQ2t2JYMH9lSy4NVWNpH
-----END CERTIFICATE-----
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.5.20

0 comments on commit 6804205

Please sign in to comment.