server: split server test suite to run in parallel on circleci (#309)

Co-authored-by: rakeshkky <12475069+rakeshkky@users.noreply.github.com>
Co-authored-by: Vishnu Bharathi P <vishnubharathi04@gmail.com>
Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
Co-authored-by: Nizar Malangadan <nizar-m@users.noreply.github.com>
Co-authored-by: nizar-m <19857260+nizar-m@users.noreply.github.com>
GitOrigin-RevId: b8a1e9c3ba4797bad8dbb2daa75d23d4ad163546
This commit is contained in:
Swann Moreau 2021-01-25 13:53:12 +05:30 committed by hasura-bot
parent f64e2f1aab
commit d4b474061f
6 changed files with 632 additions and 427 deletions

3
.circleci/README.md Normal file
View File

@ -0,0 +1,3 @@
TODO(swann): write this out better
Any tests in `test-server.sh` should also have their names added to `server-test-names.txt`, otherwise the CI pipelines will not run them.

View File

@ -25,6 +25,12 @@ if [[ "$CIRCLE_BRANCH" = "release-"* ]]; then
exit
fi
# always build commits tagged [force ci]
if git log --format=%B -n 1 $CIRCLE_SHA | grep -q "\[force ci\]"; then
echo "Forcing CI run as requested"
exit
fi
# get the diff
if [[ ! -z "$CIRCLE_COMPARE_URL" ]]; then
# CIRCLE_COMPARE_URL is not empty, use it to get the diff
@ -57,4 +63,4 @@ fi
echo "Only ignored files are present in commits, build is not required, write the skip_job file"
echo "true" > /build/ciignore/skip_job.txt
exit
exit

View File

@ -16,6 +16,13 @@ refs:
run:
name: checking if server tests can be skipped
command: |
export CIRCLE_GIT_COMMIT_DESC=$(git log --format=%B -n 1 $CIRCLE_SHA)
echo "Running from git commit '$CIRCLE_GIT_COMMIT_DESC'"
if echo $CIRCLE_GIT_COMMIT_DESC | grep "\[force ci\]"; then
echo "Forcing CI run as requested"
exit 0
fi
echo "PR number: $CIRCLE_PR_NUMBER"
if [ -z "$CIRCLE_PR_NUMBER" ]; then
echo "Not a PR build, continuing test" && exit 0
@ -91,6 +98,7 @@ refs:
# ref test server job
test_server: &test_server
working_directory: ~/graphql-engine
parallelism: 32
steps:
- attach_workspace:
at: /build
@ -126,7 +134,12 @@ refs:
GRAPHQL_ENGINE: /build/_server_output/graphql-engine
GRAPHQL_ENGINE_TESTS: /build/_server_output/graphql-engine-tests
MIX_FILES_FOLDER: /build/_server_output/mix
command: OUTPUT_FOLDER="/build/_server_test_output/$PG_VERSION" .circleci/test-server.sh
command: |
# TODO(swann): not oss-.circleci right
cat .circleci/server-test-names.txt | circleci tests split | while read -r server_test; do
export SERVER_TEST_TO_RUN=$server_test
OUTPUT_FOLDER="/build/_server_test_output/$PG_VERSION" .circleci/test-server.sh
done
- store_artifacts:
path: /build/_server_test_output
destination: server_test

View File

@ -0,0 +1,30 @@
test-server-flags
haskell-tests
no-auth
admin-secret
admin-secret-unauthorized-role
jwt
jwt-stringified
jwt-audience-check-single-string
jwt-audience-check-list-string
jwt-issuer-check
jwt-with-claims-namespace-path
jwt-claims-map-with-json-path-values
jwt-claims-map-with-literal-values
jwt-with-expiry-time-leeway
cors-domains
ws-init-cookie-read-cors-enabled
ws-init-cookie-noread
ws-init-cookie-read-cors-disabled
ws-graphql-api-disabled
ws-metadata-api-disabled
remote-schema-permissions
query-caching
query-logs
post-webhook
get-webhook
insecure-webhook
insecure-webhook-with-admin-secret
allowlist-queries
jwk-url
horizontal-scaling

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,10 @@ import http.server
import traceback
import sys
# FIXME(swann):
print("in webhook.py")
print("__name__ == {}".format(__name__))
class S(http.server.BaseHTTPRequestHandler):
@ -70,8 +74,10 @@ def run(keyfile, certfile, server_class=http.server.HTTPServer, handler_class=S,
httpd.serve_forever()
if __name__ == "__main__":
if len(sys.argv) != 4:
print("Usage: python webhook.py port keyfile certfile")
sys.exit(1)
run(keyfile=sys.argv[2],certfile=sys.argv[3], port=int(sys.argv[1]))
port=int(sys.argv[1])
print("Starting webhook on port {}".format(port))
run(keyfile=sys.argv[2],certfile=sys.argv[3], port=port)
print("Exiting webhook")