@@ -320,7 +320,10 @@ else
320
320
--tag nginx-s3-gateway --tag nginx-s3-gateway:${nginx_type} .
321
321
fi
322
322
323
+ unit_test_command=" -t module -p '/etc/nginx'"
324
+
323
325
if [ ${njs_latest} -eq 1 ]; then
326
+ unit_test_command=" -m -p '/etc/nginx'"
324
327
p " Layering in latest NJS build"
325
328
docker build -f Dockerfile.latest-njs \
326
329
--tag nginx-s3-gateway --tag nginx-s3-gateway:latest-njs-${nginx_type} .
337
340
338
341
runUnitTestWithOutSessionToken () {
339
342
test_code=" $1 "
340
-
341
- # MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
342
- # https://github.com/docker/for-win/issues/6754#issuecomment-629702199
343
- MSYS_NO_PATHCONV=1 " ${docker_cmd} " run \
344
- --rm \
345
- -v " $( pwd) /test/unit:/var/tmp" \
346
- --workdir /var/tmp \
347
- -e " DEBUG=true" \
348
- -e " S3_STYLE=virtual" \
349
- -e " AWS_ACCESS_KEY_ID=unit_test" \
350
- -e " AWS_SECRET_ACCESS_KEY=unit_test" \
351
- -e " S3_BUCKET_NAME=unit_test" \
352
- -e " S3_SERVER=unit_test" \
353
- -e " S3_SERVER_PROTO=https" \
354
- -e " S3_SERVER_PORT=443" \
355
- -e " S3_REGION=test-1" \
356
- -e " AWS_SIGS_VERSION=4" \
357
- --entrypoint /usr/bin/njs \
358
- nginx-s3-gateway -t module -p ' /etc/nginx' /var/tmp/" ${test_code} "
343
+ # Temporary hack while njs transitions to supporting -m in the cli tool
344
+ if [ ${njs_latest} -eq 1 ]
345
+ then
346
+ # MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
347
+ # https://github.com/docker/for-win/issues/6754#issuecomment-629702199
348
+ MSYS_NO_PATHCONV=1 " ${docker_cmd} " run \
349
+ --rm \
350
+ -v " $( pwd) /test/unit:/var/tmp" \
351
+ --workdir /var/tmp \
352
+ -e " DEBUG=true" \
353
+ -e " S3_STYLE=virtual" \
354
+ -e " AWS_ACCESS_KEY_ID=unit_test" \
355
+ -e " AWS_SECRET_ACCESS_KEY=unit_test" \
356
+ -e " S3_BUCKET_NAME=unit_test" \
357
+ -e " S3_SERVER=unit_test" \
358
+ -e " S3_SERVER_PROTO=https" \
359
+ -e " S3_SERVER_PORT=443" \
360
+ -e " S3_REGION=test-1" \
361
+ -e " AWS_SIGS_VERSION=4" \
362
+ --entrypoint /usr/bin/njs \
363
+ nginx-s3-gateway -m -p ' /etc/nginx' /var/tmp/" ${test_code} "
364
+ else
365
+ # MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
366
+ # https://github.com/docker/for-win/issues/6754#issuecomment-629702199
367
+ MSYS_NO_PATHCONV=1 " ${docker_cmd} " run \
368
+ --rm \
369
+ -v " $( pwd) /test/unit:/var/tmp" \
370
+ --workdir /var/tmp \
371
+ -e " DEBUG=true" \
372
+ -e " S3_STYLE=virtual" \
373
+ -e " AWS_ACCESS_KEY_ID=unit_test" \
374
+ -e " AWS_SECRET_ACCESS_KEY=unit_test" \
375
+ -e " S3_BUCKET_NAME=unit_test" \
376
+ -e " S3_SERVER=unit_test" \
377
+ -e " S3_SERVER_PROTO=https" \
378
+ -e " S3_SERVER_PORT=443" \
379
+ -e " S3_REGION=test-1" \
380
+ -e " AWS_SIGS_VERSION=4" \
381
+ --entrypoint /usr/bin/njs \
382
+ nginx-s3-gateway -t module -p ' /etc/nginx' /var/tmp/" ${test_code} "
383
+ fi
359
384
}
360
385
361
386
runUnitTestWithSessionToken () {
362
387
test_code=" $1 "
363
-
364
- # MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
365
- # https://github.com/docker/for-win/issues/6754#issuecomment-629702199
366
- MSYS_NO_PATHCONV=1 " ${docker_cmd} " run \
367
- --rm \
368
- -v " $( pwd) /test/unit:/var/tmp" \
369
- --workdir /var/tmp \
370
- -e " DEBUG=true" \
371
- -e " S3_STYLE=virtual" \
372
- -e " AWS_ACCESS_KEY_ID=unit_test" \
373
- -e " AWS_SECRET_ACCESS_KEY=unit_test" \
374
- -e " AWS_SESSION_TOKEN=unit_test" \
375
- -e " S3_BUCKET_NAME=unit_test" \
376
- -e " S3_SERVER=unit_test" \
377
- -e " S3_SERVER_PROTO=https" \
378
- -e " S3_SERVER_PORT=443" \
379
- -e " S3_REGION=test-1" \
380
- -e " AWS_SIGS_VERSION=4" \
381
- --entrypoint /usr/bin/njs \
382
- nginx-s3-gateway -t module -p ' /etc/nginx' /var/tmp/" ${test_code} "
388
+ # Temporary hack while njs transitions to supporting -m in the cli tool
389
+ if [ ${njs_latest} -eq 1 ]
390
+ then
391
+ # MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
392
+ # https://github.com/docker/for-win/issues/6754#issuecomment-629702199
393
+ MSYS_NO_PATHCONV=1 " ${docker_cmd} " run \
394
+ --rm \
395
+ -v " $( pwd) /test/unit:/var/tmp" \
396
+ --workdir /var/tmp \
397
+ -e " DEBUG=true" \
398
+ -e " S3_STYLE=virtual" \
399
+ -e " AWS_ACCESS_KEY_ID=unit_test" \
400
+ -e " AWS_SECRET_ACCESS_KEY=unit_test" \
401
+ -e " AWS_SESSION_TOKEN=unit_test" \
402
+ -e " S3_BUCKET_NAME=unit_test" \
403
+ -e " S3_SERVER=unit_test" \
404
+ -e " S3_SERVER_PROTO=https" \
405
+ -e " S3_SERVER_PORT=443" \
406
+ -e " S3_REGION=test-1" \
407
+ -e " AWS_SIGS_VERSION=4" \
408
+ --entrypoint /usr/bin/njs \
409
+ nginx-s3-gateway -m -p ' /etc/nginx' /var/tmp/" ${test_code} "
410
+ else
411
+ # MSYS_NO_PATHCONV=1 added to resolve automatic path conversion
412
+ # https://github.com/docker/for-win/issues/6754#issuecomment-629702199
413
+ MSYS_NO_PATHCONV=1 " ${docker_cmd} " run \
414
+ --rm \
415
+ -v " $( pwd) /test/unit:/var/tmp" \
416
+ --workdir /var/tmp \
417
+ -e " DEBUG=true" \
418
+ -e " S3_STYLE=virtual" \
419
+ -e " AWS_ACCESS_KEY_ID=unit_test" \
420
+ -e " AWS_SECRET_ACCESS_KEY=unit_test" \
421
+ -e " AWS_SESSION_TOKEN=unit_test" \
422
+ -e " S3_BUCKET_NAME=unit_test" \
423
+ -e " S3_SERVER=unit_test" \
424
+ -e " S3_SERVER_PROTO=https" \
425
+ -e " S3_SERVER_PORT=443" \
426
+ -e " S3_REGION=test-1" \
427
+ -e " AWS_SIGS_VERSION=4" \
428
+ --entrypoint /usr/bin/njs \
429
+ nginx-s3-gateway -t module -p ' /etc/nginx' /var/tmp/" ${test_code} "
430
+ fi
383
431
}
384
432
385
433
p " Running unit tests for utils"
0 commit comments