From fda92f8f8d16adf19fee11f4f30e4bdef0398221 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Fri, 9 Jul 2021 13:04:55 -0700 Subject: [PATCH] Reenable custom auth integration tests and add to CI (#382) --- .github/workflows/ci.yml | 2 +- .../run-jobs-integration-test.sh | 8 ++++++- integration-testing/run-tests.sh | 21 ++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 771f73b..b3e0eb8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: fail-fast: false matrix: node-version: [10.x] - test-type: [websocket, certificate] + test-type: [websocket, certificate, custom-auth] steps: - uses: actions/checkout@v2 diff --git a/integration-testing/integration-tests/run-jobs-integration-test.sh b/integration-testing/integration-tests/run-jobs-integration-test.sh index 9490402..12028c1 100755 --- a/integration-testing/integration-tests/run-jobs-integration-test.sh +++ b/integration-testing/integration-tests/run-jobs-integration-test.sh @@ -60,7 +60,8 @@ then PROC2_PID=$! $NODE $INT_TEST_DIR/jobs-integration-test.js -H $HOSTNAME -f $CERT_DIR -t1 --debug=true -T $TEST_TAG | tee $PROC1_OUTFILE & PROC1_PID=$! -else +elif [ $AUTHENTICATION_TYPE"" == "websocket" ] +then echo "###################################################################" echo ${0##*/}": running jobs integration test (websocket/sigv4)" echo "###################################################################" @@ -68,6 +69,11 @@ else PROC2_PID=$! $NODE $INT_TEST_DIR/jobs-integration-test.js -H $HOSTNAME -P=wss -t1 --debug=true -T $TEST_TAG | tee $PROC1_OUTFILE & PROC1_PID=$! +else + echo "###################################################################" + echo ${0##*/}": skipping jobs integration test (custom_auth)" + echo "###################################################################" + exit 0 fi # # Wait on the two partner processes and record their exit codes. diff --git a/integration-testing/run-tests.sh b/integration-testing/run-tests.sh index 17f1e8b..7450dc9 100755 --- a/integration-testing/run-tests.sh +++ b/integration-testing/run-tests.sh @@ -8,7 +8,7 @@ # # PARAMETERS # -# : [websocket|certificate] +# : [websocket|certificate|custom-auth] # # This program will first validate the given parameters, then attempt to # retrieve required secrets from AWS secrets manager; if both are successful, it @@ -53,9 +53,10 @@ then export AUTHENTICATION_TYPE=$1 if [ $AUTHENTICATION_TYPE"" != "websocket" ] && \ - [ $AUTHENTICATION_TYPE"" != "certificate" ] + [ $AUTHENTICATION_TYPE"" != "certificate" ] && \ + [ $AUTHENTICATION_TYPE"" != "custom-auth" ] then - echo ${0##*/}": authentication-type must be one of [websocket|certificate]" + echo ${0##*/}": authentication-type must be one of [websocket|certificate|custom-auth]" exit 2 fi export LONG_RUNNING_TEST="" @@ -166,6 +167,20 @@ case $AUTHENTICATION_TYPE"" in exit $? ;; + custom-auth) + echo "###################################################################" + echo ${0##*/}": setting custom-auth credentials" + echo "###################################################################" + + export CUSTOM_AUTH_HEADERS="{ \"X-Amz-CustomAuthorizer-Name\": \"SDKTestAuthorizer\", \"X-Amz-CustomAuthorizer-Signature\": \"vHPdrbNsr24wR+OcR45el1xh14MtJu5zLPp5ZhoJo9mGCmWQcFj9wPhgYWmgX/900T3NFhB+c7fN8Cln7r6ZszMQP48fjFiF95FmqlXPENlEDWuLN8kCVE3BRr12fcvXDNo9gPEWYE71KkWDLTrqtuOIDFAp39zduEPhzN3bj0yn+0RCMA7X9Q3BNxJji+Rq1U68jCWTjGay9cz3P+PnxfL5zqnoeJhg7baJG+xf7b1kmDw9lMzUSXNGs6FTxO66TzOscZ6I8oOWrMUvTSe24j4POs00bROOTWc0XXoCvX/v4W+TI/Oe3jnJXfXcmOqLXLPqapgWL2XobiOnFjl0PA==\", \"SDKTestAuthorizerToken\": \"abc123\" }" + + # Make sure it won't reject the internal cert used by Gamma PDX. Once we switch to prod, remove this line + export NODE_TLS_REJECT_UNAUTHORIZED=0 + + $RUN_INTEGRATION_TESTS + exit $? + ;; + certificate) export JOBS_AWS_ACCESS_KEY_ID=$principal export JOBS_AWS_SECRET_ACCESS_KEY=$credential