Skip to content

Commit

Permalink
DOSE-582 Add minio support in zfs test framework (openzfs#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
nupur-agrawal-delphix authored Sep 1, 2021
1 parent 7ce5a4a commit a5fd405
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 28 deletions.
5 changes: 3 additions & 2 deletions scripts/zfs-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ if [ -n "$ZTS_OBJECT_STORE" ]; then

# Verify connectivity before proceeding
/sbin/zoa_test -p "$ZTS_CREDS_PROFILE" -b "$ZTS_BUCKET_NAME" \
test_connectivity >/dev/null 2>&1 || \
fail "Unable to connect to $ZTS_BUCKET_NAME"
-e "$ZTS_OBJECT_ENDPOINT" \
test_connectivity >/dev/null 2>&1 || \
fail "Unable to connect to $ZTS_BUCKET_NAME"

elif [ -z "${DISKS}" ]; then
#
Expand Down
3 changes: 2 additions & 1 deletion tests/runfiles/object_store.run
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ tags = ['functional', 'cli_root', 'zfs_change-key']

# -------------------------------------------------------------
# TODO: Add the following tests back after relevant bug fixes.
# zpool_create_007_neg - DOSE-608
# zpool_create_018_pos - DOSE-550
# zpool_create_encrypted - DOSE-550
# zpool_create_features_002_pos - DOSE-550
Expand All @@ -119,7 +120,7 @@ tags = ['functional', 'cli_root', 'zfs_change-key']
[tests/functional/cli_root/zpool_create]
tests = ['zpool_create_001_pos', 'zpool_create_002_pos',
'zpool_create_003_pos', 'zpool_create_004_pos', 'zpool_create_005_pos',
'zpool_create_006_pos', 'zpool_create_007_neg', 'zpool_create_008_pos',
'zpool_create_006_pos', 'zpool_create_008_pos',
'zpool_create_009_neg', 'zpool_create_010_neg', 'zpool_create_011_neg',
'zpool_create_012_neg', 'zpool_create_014_neg', 'zpool_create_015_neg',
'zpool_create_017_neg', 'zpool_create_019_pos',
Expand Down
23 changes: 18 additions & 5 deletions tests/zfs-tests/include/libtest.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,24 @@ function is_kmemleak

function use_object_store
{
if [ -n "$ZTS_OBJECT_STORE" ]; then
return 0
else
return 1
fi
if [ -n "$ZTS_OBJECT_STORE" ]; then
return 0
else
return 1
fi
}

# Determine if ZTS_OBJECT_ENDPOINT points to AWS S3
#
# Return 0 if ZTS_OBJECT_ENDPOINT points to AWS S3, 1 if otherwise

function endpoint_is_s3
{
if [[ $ZTS_OBJECT_ENDPOINT == "https://s3*" ]]; then
return 0
else
return 1
fi
}

# Determine whether a dataset is mounted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,22 @@ if use_object_store; then
-o object-region=$ZTS_REGION \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 $ZTS_BUCKET_NAME" \
"-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=blah \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 $ZTS_BUCKET_NAME" \
"-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 blah" \
"-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 $ZTS_BUCKET_NAME mirror" \
"-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 $ZTS_BUCKET_NAME raidz" \
"-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 $ZTS_BUCKET_NAME draid" \
"$object_store_params $TESTPOOL s3 blah" \
"$object_store_params $TESTPOOL s3 $ZTS_BUCKET_NAME mirror" \
"$object_store_params $TESTPOOL s3 $ZTS_BUCKET_NAME raidz" \
"$object_store_params $TESTPOOL s3 $ZTS_BUCKET_NAME draid" \
"$TESTPOOL s3 $ZTS_BUCKET_NAME" \
"$TESTPOOL $ZTS_BUCKET_NAME"

# Testing with invalid region is not applicable for minio. Minio ignores
# object-region value and hence, the command will pass instead of
# failing. We should add this test case for just AWS S3.
if endpoint_is_s3; then
args+=("-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=blah \
-o object-credentials-profile=$ZTS_CREDS_PROFILE \
$TESTPOOL s3 $ZTS_BUCKET_NAME")
fi
else
set -A args "" "-?" "-n" "-f" "-nf" "-fn" "-f -n" "--f" "-e" "-s" \
"-m" "-R" "-m -R" "-Rm" "-mR" "-m $TESTDIR $TESTPOOL" \
Expand Down

0 comments on commit a5fd405

Please sign in to comment.