Skip to content

Commit

Permalink
Address PR#2969 suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
mannreis committed Aug 13, 2024
1 parent b05e95e commit dc62192
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 28 deletions.
15 changes: 0 additions & 15 deletions unit_test/.aws/config

This file was deleted.

8 changes: 0 additions & 8 deletions unit_test/.aws/credentials

This file was deleted.

2 changes: 1 addition & 1 deletion unit_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ ENDIF()
add_bin_test(unit_test tst_exhash timer_utils.c)
add_bin_test(unit_test tst_xcache timer_utils.c)

FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/\.aws)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.sh)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)
2 changes: 2 additions & 0 deletions unit_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ if NETCDF_ENABLE_S3_TESTALL
check_PROGRAMS += test_s3sdk
TESTS += run_s3sdk.sh
endif
check_PROGRAMS += aws_config
TESTS += run_aws_config.sh
endif

EXTRA_DIST = CMakeLists.txt run_s3sdk.sh run_reclaim_tests.sh
Expand Down
34 changes: 30 additions & 4 deletions unit_test/run_aws_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,43 @@ isolate "testdir_ut_aws_config"
THISDIR=`pwd`
cd $ISOPATH

mkdir -p $THISDIR/.aws/
echo """[uni]
region = somewhere-1
endpoint_url = https://example.com/bucket/prefix/1
key = value
extrakey = willbepropagated
[profile unidata]
region = us-east-1
endpoint_url = https://play.min.io/
dummy_key = dummy_value
[profile play]
region = us-east-1
endpoint_url = https://play.min.io/""" > $THISDIR/.aws/config


echo """[play]
aws_access_key_id = DummyKeys
aws_secret_access_key = DummySecret
[uni]
region = somewhere-2
endpoint_url = https://example.com/bucket/prefix/2
key = value2""" > $THISDIR/.aws/credentials

echo -e "Testing loading AWS configuration in ${THISDIR}/.aws/config"
env NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=unidata ${CMD} ${execdir}/aws_config endpoint_url region dummy_key
NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=unidata ${CMD} ${execdir}/aws_config endpoint_url region dummy_key
echo "Status: $?"

env NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=play ${CMD} ${execdir}/aws_config endpoint_url region
NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=play ${CMD} ${execdir}/aws_config endpoint_url region
echo "Status: $?"

env NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=uni ${CMD} ${execdir}/aws_config endpoint_url region key
NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=uni ${CMD} ${execdir}/aws_config endpoint_url region key
echo "Status: $?"

env NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=uni ${CMD} ${execdir}/aws_config region=somewhere-2 endpoint_url=https://example.com/bucket/prefix/2 key=value2 extrakey=willbepropagated
NC_TEST_AWS_DIR=${THISDIR} AWS_PROFILE=uni ${CMD} ${execdir}/aws_config region=somewhere-2 endpoint_url=https://example.com/bucket/prefix/2 key=value2 extrakey=willbepropagated
echo "Status: $?"

echo ${CMD} ${execdir}/aws_config
Expand Down

0 comments on commit dc62192

Please sign in to comment.