Skip to content

Commit

Permalink
DLPX-86444 block_to_object tests are not run in ZTS (openzfs#903)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwk404 authored Jul 20, 2023
1 parent 2f033cd commit be47f9f
Show file tree
Hide file tree
Showing 12 changed files with 183 additions and 27 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/scripts/reclaim_disk_space.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -eu

# remove 4GiB of images
sudo systemd-run docker system prune --force --all --volumes

# remove unused software
sudo systemd-run --wait rm -rf \
"$AGENT_TOOLSDIRECTORY" \
/opt/* \
/usr/local/* \
/usr/share/az* \
/usr/share/dotnet \
/usr/share/gradle* \
/usr/share/miniconda \
/usr/share/swift \
/var/lib/gems \
/var/lib/mysql \
/var/lib/snapd

# trim the cleaned space
sudo fstrim /
21 changes: 11 additions & 10 deletions scripts/zfs-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,17 @@ __ZFS_POOL_EXCLUDE="$KEEP"

. "$STF_SUITE/include/default.cfg"

#
# Create sparse files for the test suite. These may be used directly or have
# loopback devices layered on them. They may be used in block and object store
# runs.
#
for TEST_FILE in ${FILES}; do
[ -f "$TEST_FILE" ] && fail "Failed file exists: ${TEST_FILE}"
truncate -s "${FILESIZE}" "${TEST_FILE}" ||
fail "Failed creating: ${TEST_FILE} ($?)"
done

#
# If ZTS_OBJECT_STORE is set, it implies that we are using object storage.
# Hence, no need to specify disks.
Expand Down Expand Up @@ -1057,16 +1068,6 @@ elif [ -z "${DISKS}" ]; then
#
[ "$TAGS" = "perf" ] && fail "Running perf tests without disks."

#
# Create sparse files for the test suite. These may be used
# directory or have loopback devices layered on them.
#
for TEST_FILE in ${FILES}; do
[ -f "$TEST_FILE" ] && fail "Failed file exists: ${TEST_FILE}"
truncate -s "${FILESIZE}" "${TEST_FILE}" ||
fail "Failed creating: ${TEST_FILE} ($?)"
done

#
# If requested setup loopback devices backed by the sparse files.
#
Expand Down
2 changes: 0 additions & 2 deletions tests/runfiles/object_store.run
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ tags = ['functional', 'pool_checkpoint']
timeout = 1800

[tests/functional/block_to_object]
pre =
post =
tests = ['zpool_add', 'zpool_add_args_neg', 'zpool_add_ckpoint',
'zpool_add_existing', 'zpool_add_with_writes',
'hybrid_pool_import_export', 'hybrid_pool_negative',
Expand Down
26 changes: 26 additions & 0 deletions tests/test-runner/bin/zts-report.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,32 @@ elif sys.platform.startswith('linux'):
if 'ZTS_OBJECT_STORE' in os.environ and \
re.search("^true$|^s3$|^blob$", os.getenv('ZTS_OBJECT_STORE')):
maybe.update({
'block_to_object/setup': ['SKIP', devices_not_available_reason],
'block_to_object/hybrid_pool_import_export':
['SKIP', devices_not_available_reason],
'block_to_object/hybrid_pool_negative':
['SKIP', devices_not_available_reason],
'block_to_object/pool_migration_obsolete_counts':
['SKIP', devices_not_available_reason],
'block_to_object/pool_migration_with_import_export':
['SKIP', devices_not_available_reason],
'block_to_object/pool_migration_with_writes':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add_args_neg':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add_ckpoint':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add_existing':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add_mid_removal_export':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add_mid_removal':
['SKIP', devices_not_available_reason],
'block_to_object/zpool_add_with_writes':
['SKIP', devices_not_available_reason],
'block_to_object/cleanup': ['SKIP', devices_not_available_reason],
'cli_root/zdb/zdb_decompress_zstd': ['FAIL', 'DLPX-83066'],
'cli_root/zfs_destroy/zfs_clone_livelist_condense_and_disable':
['FAIL', 'QA-38583'],
Expand Down
15 changes: 15 additions & 0 deletions tests/zfs-tests/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ nobase_dist_datadir_zfs_tests_tests_DATA += \
functional/alloc_class/alloc_class.kshlib \
functional/atime/atime.cfg \
functional/atime/atime_common.kshlib \
functional/block_to_object/block_to_object.kshlib \
functional/cache/cache.cfg \
functional/cache/cache.kshlib \
functional/cachefile/cachefile.cfg \
Expand Down Expand Up @@ -445,6 +446,20 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/background_freeing/cleanup.ksh \
functional/background_freeing/default_free_space_reclaimation.ksh \
functional/background_freeing/setup.ksh \
functional/block_to_object/cleanup.ksh \
functional/block_to_object/hybrid_pool_import_export.ksh \
functional/block_to_object/hybrid_pool_negative.ksh \
functional/block_to_object/pool_migration_obsolete_counts.ksh \
functional/block_to_object/pool_migration_with_import_export.ksh \
functional/block_to_object/pool_migration_with_writes.ksh \
functional/block_to_object/setup.ksh \
functional/block_to_object/zpool_add_args_neg.ksh \
functional/block_to_object/zpool_add_ckpoint.ksh \
functional/block_to_object/zpool_add_existing.ksh \
functional/block_to_object/zpool_add.ksh \
functional/block_to_object/zpool_add_mid_removal_export.ksh \
functional/block_to_object/zpool_add_mid_removal.ksh \
functional/block_to_object/zpool_add_with_writes.ksh \
functional/bootfs/bootfs_001_pos.ksh \
functional/bootfs/bootfs_002_neg.ksh \
functional/bootfs/bootfs_003_pos.ksh \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,19 @@ DATASET=$TESTPOOL/$TESTFS
TESTFILE0=/$DATASET/00
TESTFILE1=/$DATASET/01

DISK="$(echo $DISKS | cut -d' ' -f1)"
EXTRADISK="$(echo $DISKS | cut -d' ' -f2)"
# This test can use files or disks, depending on where it's run.
# When run outside of a github workflow, the Zettacache devices are
# repurposed as the block devices for test pools. This is done in the
# setup and cleanup tests.
if [ -n "$GITHUB_WORKFLOW" ]; then
DISK="$FILEDIR/file-vdev0"
EXTRADISK="$FILEDIR/file-vdev1"
IMPORT_DIR=$FILEDIR
else
DISK="${ZETTACACHE_DEVICES%% *}"
EXTRADISK="${ZETTACACHE_DEVICES##* }"
IMPORT_DIR=${DEVICE_DIR:-/dev}
fi

function setup_testpool # args: [<optional ashift>]
{
Expand Down Expand Up @@ -71,7 +82,7 @@ function cleanup_testpool
# or zdb do not get confused with leftover
# data from old pools.
#
for disk in $DISKS; do
for disk in $DISK $EXTRADISK; do
zpool labelclear -f $disk
done

Expand Down
38 changes: 38 additions & 0 deletions tests/zfs-tests/tests/functional/block_to_object/cleanup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2023 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/include/object_store.shlib

# Restore the Zettacache devices if we removed them in setup.
if [ -z "$GITHUB_WORKFLOW" ]; then
for device in $ZETTACACHE_DEVICES; do
log_must create_slog_zcache_partition ${device##*/}
log_must zcache add $(get_cache_part $device)
done
fi

log_pass
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ for ashift in 9 12; do
#
# Attempt to import by only specifying the block vdev
#
log_mustnot zpool import -d ${DEVICE_DIR:-/dev} $TESTPOOL
log_mustnot zpool import -d ${DEVICE_DIR:-/dev} $GUID
log_mustnot zpool import -d $IMPORT_DIR $TESTPOOL
log_mustnot zpool import -d $IMPORT_DIR $GUID

#
# Import pool using object-store parameters
Expand All @@ -84,7 +84,7 @@ for ashift in 9 12; do
-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-d $ZTS_BUCKET_NAME \
-d ${DEVICE_DIR:-/dev} \
-d $IMPORT_DIR \
$GUID

cleanup_testpool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ for ashift in 9 12; do
-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-d $ZTS_BUCKET_NAME \
-d ${DEVICE_DIR:-/dev} \
-d $IMPORT_DIR \
$GUID

#
Expand Down
51 changes: 51 additions & 0 deletions tests/zfs-tests/tests/functional/block_to_object/setup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2023 by Delphix. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/include/object_store.shlib

if ! use_object_store; then
log_unsupported "Test not applicable for block based run"
fi

if [ -z "$GITHUB_WORKFLOW" ]; then
if [ $(wc -w <<<$ZETTACACHE_DEVICES) -lt 2 ]; then
log_unsupported "Tests require two block devices"
fi

# These tests use the Zettacache devices to create block based pools for
# migration. They get added back as Zettacache devices in the cleanup
# script.
log_must zcache_remove_devices $ZETTACACHE_DEVICES

# Removing the cache devices can leave the labels in a state that
# `zpool add` # cannot handle. Force a pool creation and destruction to
# avoid this.
log_must zpool create -f foo $ZETTACACHE_DEVICES
log_must zpool destroy foo
fi

log_pass
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ log_mustnot zpool add -f -o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
$TESTPOOL $ZTS_OBJECT_STORE thisisbogus

#
# Attempt with bogus region
#
log_mustnot zpool add -f -o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=thisisbogus \
$TESTPOOL $ZTS_OBJECT_STORE $ZTS_BUCKET_NAME

#
# Attempt with bogus endpoint
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ for ashift in 9 12; do
-o object-endpoint=$ZTS_OBJECT_ENDPOINT \
-o object-region=$ZTS_REGION \
-d $ZTS_BUCKET_NAME \
-d ${DEVICE_DIR:-/dev} \
-d $IMPORT_DIR \
$GUID

#
Expand Down

0 comments on commit be47f9f

Please sign in to comment.