Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions libdispatch/ncs3sdk_h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,7 @@ NC_s3sdkcreateclient(NCS3INFO* info)

s3client = (NCS3CLIENT*)calloc(1,sizeof(NCS3CLIENT));
if(s3client == NULL) goto done;
if(info->profile != NULL) {
if((stat = NC_s3profilelookup(info->profile, AWS_PROF_ACCESS_KEY_ID, &accessid))) goto done;
if((stat = NC_s3profilelookup(info->profile, AWS_PROF_SECRET_ACCESS_KEY, &accesskey))) goto done;
}
NC_s3getcredentials(info->profile, NULL, &accessid, &accesskey);
if((s3client->rooturl = makes3rooturl(info))==NULL) {stat = NC_ENOMEM; goto done;}
s3client->h5s3client = NCH5_s3comms_s3r_open(s3client->rooturl,info->svc,info->region,accessid,accesskey);
if(s3client->h5s3client == NULL) {stat = NC_ES3; goto done;}
Expand Down
1 change: 1 addition & 0 deletions nczarr_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ IF(NETCDF_ENABLE_TESTS)
add_sh_test(nczarr_test run_scalar)
add_sh_test(nczarr_test run_nulls)
add_sh_test(nczarr_test run_external)
add_sh_test(nczarr_test run_s3_credentials)
add_sh_test(nczarr_test run_quantize)
add_sh_test(nczarr_test run_notzarr)

Expand Down
3 changes: 2 additions & 1 deletion nczarr_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ TESTS += run_notzarr.sh

if NETCDF_ENABLE_EXTERNAL_SERVER_TESTS
TESTS += run_external.sh
TESTS += run_s3_credentials.sh
endif

# Unlimited Dimension tests (at least in part)
Expand Down Expand Up @@ -213,7 +214,7 @@ run_purezarr.sh run_interop.sh run_misc.sh \
run_filter.sh run_filter_errors.sh\
run_newformat.sh run_nczarr_fill.sh run_quantize.sh \
run_jsonconvention.sh run_nczfilter.sh run_unknown.sh \
run_scalar.sh run_strings.sh run_nulls.sh run_notzarr.sh run_external.sh \
run_scalar.sh run_strings.sh run_nulls.sh run_notzarr.sh run_external.sh run_s3_credentials.sh\
run_unlim_io.sh run_corrupt.sh run_oldkeys.sh run_xarray_misc.sh

EXTRA_DIST += \
Expand Down
26 changes: 26 additions & 0 deletions nczarr_test/run_s3_credentials.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

set -e

. "$srcdir/test_nczarr.sh"

s3isolate "testdir_s3_credentials"
THISDIR=`pwd`
cd $ISOPATH

testcase_public_data_invalid_env() {
# ncdump is expected to fail because we are authenticatin
local cmd="${NCDUMP} -h gs3://weatherbench2/datasets/era5/1959-2023_01_10-wb13-6h-1440x721_with_derived_variables.zarr#mode=zarr,s3,consolidated"
${cmd} > /dev/null
if env -i AWS_ACCESS_KEY_ID=INVALID AWS_SECRET_ACCESS_KEY=INVALID "${cmd}" 2>&1 | grep -q 'NetCDF: Authorization failure'; then
echo "The operation should NOT have succeeded due to authentication: ${cmd}"
return 1
fi
}

if test "x$FEATURE_S3" = xyes ; then
testcase_public_data_invalid_env
fi
Loading