diff --git a/test/json_config/json_config.sh b/test/json_config/json_config.sh index 5dd95e0c6..396213469 100755 --- a/test/json_config/json_config.sh +++ b/test/json_config/json_config.sh @@ -150,6 +150,20 @@ function create_bdev_subsystem_config() { local expected_notifications=() + local event_line event ev_type ev_ctx + local rc="" + + # Before testing notifications generated by the operations in this function, we + # need add existing notification to the expected list first. Otherwise it would fail. + while read -r event_line; do + # remove ID + event="${event_line%:*}" + ev_type=${event%:*} + ev_ctx=${event#*:} + + expected_notifications+=(${ev_type}:${ev_ctx}) + done < <(tgt_rpc notify_get_notifications -i ${last_event_id} | jq -r '.[] | "\(.type):\(.ctx):\(.id)"') + if [[ $SPDK_TEST_BLOCKDEV -eq 1 ]]; then local lvol_store_base_bdev=Nvme0n1 if ! tgt_rpc get_bdevs --name ${lvol_store_base_bdev} > /dev/null; then @@ -174,7 +188,6 @@ function create_bdev_subsystem_config() { tgt_rpc bdev_malloc_create 16 4096 --name Malloc1 expected_notifications+=( - bdev_register:${lvol_store_base_bdev} bdev_register:${lvol_store_base_bdev}p1 bdev_register:${lvol_store_base_bdev}p0 bdev_register:Malloc3