Skip to content

Commit

Permalink
temporary switch on module command in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
4141done committed Feb 26, 2024
1 parent 120ae99 commit e065a7d
Showing 1 changed file with 85 additions and 38 deletions.
123 changes: 85 additions & 38 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ else
--tag nginx-s3-gateway --tag nginx-s3-gateway:${nginx_type} .
fi

unit_test_command="-t module -p '/etc/nginx'"

if [ ${njs_latest} -eq 1 ]; then
unit_test_command="-m -p '/etc/nginx'"
p "Layering in latest NJS build"
docker build -f Dockerfile.latest-njs \
--tag nginx-s3-gateway --tag nginx-s3-gateway:latest-njs-${nginx_type} .
Expand All @@ -338,48 +341,92 @@ fi
runUnitTestWithOutSessionToken() {
test_code="$1"

#MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
# https://github.com/docker/for-win/issues/6754#issuecomment-629702199
MSYS_NO_PATHCONV=1 "${docker_cmd}" run \
--rm \
-v "$(pwd)/test/unit:/var/tmp" \
--workdir /var/tmp \
-e "DEBUG=true" \
-e "S3_STYLE=virtual" \
-e "AWS_ACCESS_KEY_ID=unit_test" \
-e "AWS_SECRET_ACCESS_KEY=unit_test" \
-e "S3_BUCKET_NAME=unit_test" \
-e "S3_SERVER=unit_test" \
-e "S3_SERVER_PROTO=https" \
-e "S3_SERVER_PORT=443" \
-e "S3_REGION=test-1" \
-e "AWS_SIGS_VERSION=4" \
--entrypoint /usr/bin/njs \
nginx-s3-gateway -m -p '/etc/nginx' /var/tmp/"${test_code}"
if [ ${njs_latest} -eq 1 ]
then
#MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
# https://github.com/docker/for-win/issues/6754#issuecomment-629702199
MSYS_NO_PATHCONV=1 "${docker_cmd}" run \
--rm \
-v "$(pwd)/test/unit:/var/tmp" \
--workdir /var/tmp \
-e "DEBUG=true" \
-e "S3_STYLE=virtual" \
-e "AWS_ACCESS_KEY_ID=unit_test" \
-e "AWS_SECRET_ACCESS_KEY=unit_test" \
-e "S3_BUCKET_NAME=unit_test" \
-e "S3_SERVER=unit_test" \
-e "S3_SERVER_PROTO=https" \
-e "S3_SERVER_PORT=443" \
-e "S3_REGION=test-1" \
-e "AWS_SIGS_VERSION=4" \
--entrypoint /usr/bin/njs \
nginx-s3-gateway -m -p '/etc/nginx' /var/tmp/"${test_code}"
else
#MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
# https://github.com/docker/for-win/issues/6754#issuecomment-629702199
MSYS_NO_PATHCONV=1 "${docker_cmd}" run \
--rm \
-v "$(pwd)/test/unit:/var/tmp" \
--workdir /var/tmp \
-e "DEBUG=true" \
-e "S3_STYLE=virtual" \
-e "AWS_ACCESS_KEY_ID=unit_test" \
-e "AWS_SECRET_ACCESS_KEY=unit_test" \
-e "S3_BUCKET_NAME=unit_test" \
-e "S3_SERVER=unit_test" \
-e "S3_SERVER_PROTO=https" \
-e "S3_SERVER_PORT=443" \
-e "S3_REGION=test-1" \
-e "AWS_SIGS_VERSION=4" \
--entrypoint /usr/bin/njs \
nginx-s3-gateway -t module -p '/etc/nginx' /var/tmp/"${test_code}"
fi
}

runUnitTestWithSessionToken() {
test_code="$1"

#MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
# https://github.com/docker/for-win/issues/6754#issuecomment-629702199
MSYS_NO_PATHCONV=1 "${docker_cmd}" run \
--rm \
-v "$(pwd)/test/unit:/var/tmp" \
--workdir /var/tmp \
-e "DEBUG=true" \
-e "S3_STYLE=virtual" \
-e "AWS_ACCESS_KEY_ID=unit_test" \
-e "AWS_SECRET_ACCESS_KEY=unit_test" \
-e "AWS_SESSION_TOKEN=unit_test" \
-e "S3_BUCKET_NAME=unit_test" \
-e "S3_SERVER=unit_test" \
-e "S3_SERVER_PROTO=https" \
-e "S3_SERVER_PORT=443" \
-e "S3_REGION=test-1" \
-e "AWS_SIGS_VERSION=4" \
--entrypoint /usr/bin/njs \
nginx-s3-gateway -m -p '/etc/nginx' /var/tmp/"${test_code}"
if [ ${njs_latest} -eq 1 ]
then
#MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
# https://github.com/docker/for-win/issues/6754#issuecomment-629702199
MSYS_NO_PATHCONV=1 "${docker_cmd}" run \
--rm \
-v "$(pwd)/test/unit:/var/tmp" \
--workdir /var/tmp \
-e "DEBUG=true" \
-e "S3_STYLE=virtual" \
-e "AWS_ACCESS_KEY_ID=unit_test" \
-e "AWS_SECRET_ACCESS_KEY=unit_test" \
-e "AWS_SESSION_TOKEN=unit_test" \
-e "S3_BUCKET_NAME=unit_test" \
-e "S3_SERVER=unit_test" \
-e "S3_SERVER_PROTO=https" \
-e "S3_SERVER_PORT=443" \
-e "S3_REGION=test-1" \
-e "AWS_SIGS_VERSION=4" \
--entrypoint /usr/bin/njs \
nginx-s3-gateway -m -p '/etc/nginx' /var/tmp/"${test_code}"
else
#MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
# https://github.com/docker/for-win/issues/6754#issuecomment-629702199
MSYS_NO_PATHCONV=1 "${docker_cmd}" run \
--rm \
-v "$(pwd)/test/unit:/var/tmp" \
--workdir /var/tmp \
-e "DEBUG=true" \
-e "S3_STYLE=virtual" \
-e "AWS_ACCESS_KEY_ID=unit_test" \
-e "AWS_SECRET_ACCESS_KEY=unit_test" \
-e "AWS_SESSION_TOKEN=unit_test" \
-e "S3_BUCKET_NAME=unit_test" \
-e "S3_SERVER=unit_test" \
-e "S3_SERVER_PROTO=https" \
-e "S3_SERVER_PORT=443" \
-e "S3_REGION=test-1" \
-e "AWS_SIGS_VERSION=4" \
--entrypoint /usr/bin/njs \
nginx-s3-gateway -t module -p '/etc/nginx' /var/tmp/"${test_code}"
fi
}

p "Running unit tests for utils"
Expand Down

0 comments on commit e065a7d

Please sign in to comment.