Skip to content

Commit

Permalink
QA-35958 zfs tests for s3 object store failing to run with instance p…
Browse files Browse the repository at this point in the history
…rofile (openzfs#511)

* Fix zfs tests for s3 object store to run with instance profile
* Remove zfs object store tests from block storage run-zts tests
  • Loading branch information
ankurs-delphix authored Jul 12, 2022
1 parent 6b087e9 commit 8489992
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
7 changes: 5 additions & 2 deletions scripts/zfs-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,14 @@ credentials_in_env() {
[ -n "$AZURE_KEY" ]; then
return 0
fi
return 1
;;
s3)
if [ -n "$AWS_ACCESS_KEY_ID" ] && \
[ -n "$AWS_SECRET_ACCESS_KEY" ]; then \
return 0
fi
return 1
;;
*)
return 1
Expand All @@ -678,11 +680,12 @@ test_object_store_connectivity() {
zoa_cmd="$zoa_cmd --azure-account $AZURE_ACCOUNT"
;;
s3)
# Common parameters
zoa_cmd="$zoa_cmd --region $ZTS_REGION"
zoa_cmd="$zoa_cmd --endpoint $ZTS_OBJECT_ENDPOINT"
if $use_managed_profile; then
zoa_cmd="$zoa_cmd --aws_instance_profile"
else
zoa_cmd="$zoa_cmd --region $ZTS_REGION"
zoa_cmd="$zoa_cmd --endpoint $ZTS_OBJECT_ENDPOINT"
zoa_cmd="$zoa_cmd --aws-access-key-id
$AWS_ACCESS_KEY_ID"
zoa_cmd="$zoa_cmd --aws-secret-access-key
Expand Down
4 changes: 1 addition & 3 deletions tests/runfiles/dlpx_functional.run
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,7 @@ tags = ['functional', 'cli_root', 'zpool_create']

[tests/functional/cli_root/zpool_destroy]
tests = ['zpool_destroy_001_pos', 'zpool_destroy_002_pos',
'zpool_destroy_003_neg', 'zpool_destroy_object_store',
'zpool_resume_destroy_object_store',
'zpool_resume_destroy_on_import_object_store']
'zpool_destroy_003_neg']
pre =
post =
tags = ['functional', 'cli_root', 'zpool_destroy']
Expand Down
17 changes: 13 additions & 4 deletions tests/zfs-tests/include/libtest.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ function is_using_iam_role
{
# When using IAM role both of the env variables AWS_SECRET_ACCESS_KEY
# and AWS_ACCESS_KEY_ID remains empty or zero length
[ -n "$AWS_ACCESS_KEY_ID" ] && [ -n "$AWS_SECRET_ACCESS_KEY" ] && \
return 1 || return 0
if [ -n "$AWS_ACCESS_KEY_ID" ] && \
[ -n "$AWS_SECRET_ACCESS_KEY" ]; then
return 1
fi
return 0
}


Expand Down Expand Up @@ -1850,8 +1853,14 @@ function create_pool
s3)
object_store_args="
-o object-endpoint=$ZTS_OBJECT_ENDPOINT
-o object-region=$ZTS_REGION
-o object-credentials-profile=$ZTS_CREDS_PROFILE"
-o object-region=$ZTS_REGION"
#
# Include the argument object-credentials-profile only
# when not running using instance profile.
#
! is_using_iam_role && \
object_store_args="$object_store_args
-o object-credentials-profile=$ZTS_CREDS_PROFILE"
;;
*)
log_note "Unknown object store $ZTS_OBJECT_STORE"
Expand Down

0 comments on commit 8489992

Please sign in to comment.