From 120ae99be405c5e961e278fdaa2ca84f2b92aae1 Mon Sep 17 00:00:00 2001 From: Javier Evans Date: Mon, 26 Feb 2024 14:44:55 -0800 Subject: [PATCH 1/3] move latest-njs testing to the -m module for forwards compatibility --- test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index 94346f60..a01562ef 100755 --- a/test.sh +++ b/test.sh @@ -355,7 +355,7 @@ runUnitTestWithOutSessionToken() { -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}" + nginx-s3-gateway -m -p '/etc/nginx' /var/tmp/"${test_code}" } runUnitTestWithSessionToken() { @@ -379,7 +379,7 @@ runUnitTestWithSessionToken() { -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}" + nginx-s3-gateway -m -p '/etc/nginx' /var/tmp/"${test_code}" } p "Running unit tests for utils" From e065a7d0aef0bd1119f08e820410f5ff09ad1798 Mon Sep 17 00:00:00 2001 From: Javier Evans Date: Mon, 26 Feb 2024 15:15:45 -0800 Subject: [PATCH 2/3] temporary switch on module command in unit tests --- test.sh | 123 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 38 deletions(-) diff --git a/test.sh b/test.sh index a01562ef..65790663 100755 --- a/test.sh +++ b/test.sh @@ -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} . @@ -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" From 382ec9cf677709d873dcc4d8b9de185280fbd5f3 Mon Sep 17 00:00:00 2001 From: Javier Evans Date: Mon, 26 Feb 2024 15:16:38 -0800 Subject: [PATCH 3/3] add comment --- test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 65790663..a12fd28e 100755 --- a/test.sh +++ b/test.sh @@ -340,7 +340,7 @@ fi runUnitTestWithOutSessionToken() { test_code="$1" - + # Temporary hack while njs transitions to supporting -m in the cli tool if [ ${njs_latest} -eq 1 ] then #MSYS_NO_PATHCONV=1 added to resolve automatic path conversion @@ -385,6 +385,7 @@ runUnitTestWithOutSessionToken() { runUnitTestWithSessionToken() { test_code="$1" + # Temporary hack while njs transitions to supporting -m in the cli tool if [ ${njs_latest} -eq 1 ] then #MSYS_NO_PATHCONV=1 added to resolve automatic path conversion