Skip to content

Commit 063c9fb

Browse files
authored
Merge pull request #253 from skyerus/issue-236_e2e-crd-configuration-reconciliation
chore: added crd configuration reconciliation e2e test
2 parents 0f59c50 + f4a1c25 commit 063c9fb

File tree

6 files changed

+57
-3
lines changed

6 files changed

+57
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ test: manifests generate fmt vet envtest ## Run tests.
7171
e2e-test: manifests generate fmt vet
7272
kubectl -n open-feature-operator-system apply -f ./test/e2e/e2e.yml
7373
kubectl wait --for=condition=Available=True deploy --all -n 'open-feature-operator-system'
74-
./test/e2e/e2e.sh '{"value":true,"reason":"DEFAULT","variant":"on"}'
74+
./test/e2e/run.sh
7575

7676
.PHONY: lint
7777
lint:

test/e2e/DEVELOPER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# E2E Testing
22

3-
This suite tests the end-to-end deployment of open-feature-operator by deploying an nginx reverse proxy and asserting that a curl to the proxy reaches the flagd sidecar created by open-feature-operator.
3+
This suite tests the end-to-end deployment of open-feature-operator by deploying an nginx reverse proxy and asserting that curls to the proxy elicit expected behaviour from the flagd sidecar created by open-feature-operator.
44

55
## Running on a Kind cluster
66

test/e2e/run.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
FAILURE=0
4+
5+
for FILE in "$(dirname "${BASH_SOURCE[0]}")"/tests/*;
6+
do
7+
echo "Running ${FILE##*/}";
8+
./"${FILE}"
9+
EXIT_CODE=$?
10+
if [ $EXIT_CODE -ne 0 ];
11+
then
12+
FAILURE=1
13+
echo "${FILE##*/} failed."
14+
else
15+
echo "${FILE##*/} succeeded."
16+
fi
17+
done
18+
19+
if [ $FAILURE -eq 1 ];
20+
then
21+
exit 1
22+
fi
23+

test/e2e/e2e.sh renamed to test/e2e/simple-flag-evaluation.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ RESPONSE="${RESPONSE//[[:space:]]/}" # strip whitespace from response
2020

2121
if [ "$RESPONSE" == "$EXPECTED_RESPONSE" ]
2222
then
23-
echo "Success."
2423
exit 0
2524
else
2625
echo "Expected response: $EXPECTED_RESPONSE"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
./"$(dirname "${BASH_SOURCE[0]}")"/../simple-flag-evaluation.sh '{"value":true,"reason":"DEFAULT","variant":"on"}'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
cat <<EOF | kubectl -n open-feature-operator-system apply -f -
4+
apiVersion: core.openfeature.dev/v1alpha1
5+
kind: FeatureFlagConfiguration
6+
metadata:
7+
name: end-to-end-test
8+
spec:
9+
featureFlagSpec: |
10+
{
11+
"flags": {
12+
"simple-flag": {
13+
"state": "ENABLED",
14+
"variants": {
15+
"on": true,
16+
"off": false
17+
},
18+
"defaultVariant": "off"
19+
}
20+
}
21+
}
22+
EOF
23+
24+
./"$(dirname "${BASH_SOURCE[0]}")"/../simple-flag-evaluation.sh '{"reason":"DEFAULT","variant":"off"}'
25+
EXIT_CODE=$?
26+
27+
kubectl -n open-feature-operator-system apply -f ./test/e2e/e2e.yml > /dev/null # reset state quietly
28+
29+
exit $EXIT_CODE

0 commit comments

Comments
 (0)