-
-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: fix missing tsconfig path in .eslintrc * refactor: require contextName and operator * refactor: fix crash on missing feature strategies * feat: add segments schema * feat: add segments client API * feat: add segments permissions * refactor: fail migration if things exist * refactor: remove strategy IDs from responses * refactor: allow empty description * refactor: add segment import/export * refactor: add perf scripts * refactor: add get segment fn * refactor: move constraint validation endpoint * refactor: use a separate id for segment updates * refactor: use PERF_AUTH_KEY for artillery * refactor: adjust segment seed size * refactor: add missing event data await * refactor: improve method order * refactor: remove request body limit override
- Loading branch information
Showing
50 changed files
with
1,408 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# /perf | ||
|
||
Testing performance testing! Files of note: | ||
|
||
```shell | ||
# Configure the app URL and auth token to use in performance testing. | ||
./env.sh | ||
|
||
# Export all the data from the app at the configured URL. | ||
./seed/export.sh | ||
|
||
# Import previously exported data to the app instance. | ||
./seed/import.sh | ||
|
||
# Measure the GZIP response size for interesting endpoints. | ||
./test/gzip.sh | ||
|
||
# Run a few load test scenarios against the app. | ||
./test/artillery.sh | ||
``` | ||
|
||
See also the following scripts in `package.json`: | ||
|
||
```shell | ||
# Fill the unleash_testing/seed schema with seed data. | ||
$ yarn seed:setup | ||
|
||
# Serve the unleash_testing/seed schema data, for exports. | ||
$ yarn seed:serve | ||
``` | ||
|
||
Edit files in `/test/e2e/seed` to change the amount data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
export PERF_AUTH_KEY="*:*.964a287e1b728cb5f4f3e0120df92cb5" | ||
export PERF_APP_URL="http://localhost:4242" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/export.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -feu | ||
|
||
cd "$(dirname "$0")" | ||
|
||
. ../env.sh | ||
|
||
# Export data. Delete environments since they can't be imported. | ||
curl -H "Authorization: $PERF_AUTH_KEY" "$PERF_APP_URL/api/admin/state/export" \ | ||
| jq 'del(.environments)' \ | ||
> export.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -feu | ||
|
||
cd "$(dirname "$0")" | ||
|
||
. ../env.sh | ||
|
||
curl -X POST \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: $PERF_AUTH_KEY" \ | ||
-d @export.json \ | ||
"$PERF_APP_URL/api/admin/state/import?drop=true&keep=false" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/artillery.json | ||
/artillery.json.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -feu | ||
|
||
cd "$(dirname "$0")" | ||
|
||
. ../env.sh | ||
|
||
artillery run ./artillery.yaml --output artillery.json | ||
|
||
artillery report artillery.json | ||
|
||
echo "See artillery.json.html for results" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
config: | ||
target: "http://localhost:4242" | ||
defaults: | ||
headers: | ||
authorization: "{{ $processEnvironment.PERF_AUTH_KEY }}" | ||
phases: | ||
- duration: 60 | ||
arrivalRate: 10 | ||
scenarios: | ||
- flow: | ||
- get: | ||
url: "/api/client/features" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -feu | ||
|
||
cd "$(dirname "$0")" | ||
|
||
. ../env.sh | ||
|
||
print_response_size () { | ||
local URL | ||
local RES | ||
URL="$1" | ||
RES="$(curl -s -H "Authorization: $PERF_AUTH_KEY" "$URL")" | ||
echo | ||
echo "$URL" | ||
echo | ||
echo "* Byte size: $(echo "$RES" | wc -c) bytes" | ||
echo "* GZIP size: $(echo "$RES" | gzip -6 | wc -c) bytes" | ||
} | ||
|
||
print_response_size "$PERF_APP_URL/api/admin/projects" | ||
|
||
print_response_size "$PERF_APP_URL/api/admin/features" | ||
|
||
print_response_size "$PERF_APP_URL/api/client/features" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.