test/lvol: rewrite construct_logical_volume_nonexistent_lvs_uuid to bash
Change-Id: I1223de42f328d16864e49e795efb4b81f0c5ba17 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459674 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
This commit is contained in:
parent
cf510c7047
commit
ba43a0b3ce
@ -178,6 +178,27 @@ function test_construct_lvols_conflict_alias() {
|
|||||||
check_leftover_devices
|
check_leftover_devices
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# try to create an lvol on inexistent lvs uuid
|
||||||
|
function test_construct_lvol_inexistent_lvs() {
|
||||||
|
# create an lvol store
|
||||||
|
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
|
||||||
|
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
|
||||||
|
|
||||||
|
# try to create an lvol on inexistent lvs
|
||||||
|
dummy_uuid="00000000-0000-0000-0000-000000000000"
|
||||||
|
rpc_cmd bdev_lvol_create -u "$dummy_uuid" lvol_test "$LVS_DEFAULT_CAPACITY_MB" && false
|
||||||
|
|
||||||
|
lvols=$(rpc_cmd bdev_get_bdevs | jq -r '[ .[] | select(.product_name == "Logical Volume") ]')
|
||||||
|
[ "$(jq length <<< "$lvols")" == "0" ]
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
||||||
|
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
|
||||||
|
rpc_cmd bdev_malloc_delete "$malloc_name"
|
||||||
|
check_leftover_devices
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$rootdir/app/spdk_tgt/spdk_tgt &
|
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||||
spdk_pid=$!
|
spdk_pid=$!
|
||||||
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
||||||
@ -187,6 +208,7 @@ run_test "test_construct_lvs" test_construct_lvs
|
|||||||
run_test "test_construct_lvol" test_construct_lvol
|
run_test "test_construct_lvol" test_construct_lvol
|
||||||
run_test "test_construct_multi_lvols" test_construct_multi_lvols
|
run_test "test_construct_multi_lvols" test_construct_multi_lvols
|
||||||
run_test "test_construct_lvols_conflict_alias" test_construct_lvols_conflict_alias
|
run_test "test_construct_lvols_conflict_alias" test_construct_lvols_conflict_alias
|
||||||
|
run_test "test_construct_lvol_inexistent_lvs" test_construct_lvol_inexistent_lvs
|
||||||
|
|
||||||
trap - SIGINT SIGTERM EXIT
|
trap - SIGINT SIGTERM EXIT
|
||||||
killprocess $spdk_pid
|
killprocess $spdk_pid
|
||||||
|
@ -21,7 +21,6 @@ function usage() {
|
|||||||
echo " --block-size Block size for this bdev"
|
echo " --block-size Block size for this bdev"
|
||||||
echo "-x set -x for script debug"
|
echo "-x set -x for script debug"
|
||||||
echo " --test-cases= List test cases which will be run:
|
echo " --test-cases= List test cases which will be run:
|
||||||
100: 'construct_logical_volume_nonexistent_lvs_uuid',
|
|
||||||
101: 'bdev_lvol_create_on_full_lvol_store',
|
101: 'bdev_lvol_create_on_full_lvol_store',
|
||||||
102: 'bdev_lvol_create_name_twice',
|
102: 'bdev_lvol_create_name_twice',
|
||||||
150: 'bdev_lvol_resize_positive',
|
150: 'bdev_lvol_resize_positive',
|
||||||
|
@ -111,7 +111,6 @@ def case_message(func):
|
|||||||
def inner(*args, **kwargs):
|
def inner(*args, **kwargs):
|
||||||
test_name = {
|
test_name = {
|
||||||
# bdev_lvol_create - negative tests
|
# bdev_lvol_create - negative tests
|
||||||
100: 'construct_logical_volume_nonexistent_lvs_uuid',
|
|
||||||
101: 'bdev_lvol_create_on_full_lvol_store',
|
101: 'bdev_lvol_create_on_full_lvol_store',
|
||||||
102: 'bdev_lvol_create_name_twice',
|
102: 'bdev_lvol_create_name_twice',
|
||||||
# resize_lvol_store - positive tests
|
# resize_lvol_store - positive tests
|
||||||
@ -307,27 +306,6 @@ class TestCases(object):
|
|||||||
lvs = self.c.bdev_lvol_get_lvstores(lvs_name)[0]
|
lvs = self.c.bdev_lvol_get_lvstores(lvs_name)[0]
|
||||||
return int(int(lvs['cluster_size']) / MEGABYTE)
|
return int(int(lvs['cluster_size']) / MEGABYTE)
|
||||||
|
|
||||||
@case_message
|
|
||||||
def test_case100(self):
|
|
||||||
"""
|
|
||||||
construct_logical_volume_nonexistent_lvs_uuid
|
|
||||||
|
|
||||||
Negative test for constructing a new logical_volume.
|
|
||||||
Call bdev_lvol_create with lvs_uuid which does not
|
|
||||||
exist in configuration.
|
|
||||||
"""
|
|
||||||
fail_count = 0
|
|
||||||
# Try to call bdev_lvol_create with lvs_uuid which does not exist
|
|
||||||
if self.c.bdev_lvol_create(self._gen_lvs_uuid(),
|
|
||||||
self.lbd_name,
|
|
||||||
32) == 0:
|
|
||||||
fail_count += 1
|
|
||||||
|
|
||||||
# Expected result:
|
|
||||||
# - return code != 0
|
|
||||||
# - ENODEV response printed to stdout
|
|
||||||
return fail_count
|
|
||||||
|
|
||||||
@case_message
|
@case_message
|
||||||
def test_case101(self):
|
def test_case101(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user