fix step "Try to zero metadata with 'sudo'." in test_user_cli
Signed-off-by: Karolina Rogowska <karolina.rogowska@intel.com>
This commit is contained in:
parent
8062417d10
commit
6d57168de4
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2020-2021 Intel Corporation
|
# Copyright(c) 2020-2022 Intel Corporation
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2019-2021 Intel Corporation
|
# Copyright(c) 2019-2022 Intel Corporation
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -9,8 +9,8 @@ from api.cas import casadm, cli
|
|||||||
from api.cas.cache_config import CacheMode
|
from api.cas.cache_config import CacheMode
|
||||||
from api.cas.casadm_params import OutputFormat
|
from api.cas.casadm_params import OutputFormat
|
||||||
from api.cas.init_config import InitConfig
|
from api.cas.init_config import InitConfig
|
||||||
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
|
||||||
from core.test_run import TestRun
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
|
||||||
from test_tools import fs_utils
|
from test_tools import fs_utils
|
||||||
from test_tools.disk_utils import Filesystem
|
from test_tools.disk_utils import Filesystem
|
||||||
from test_utils.output import CmdException
|
from test_utils.output import CmdException
|
||||||
@ -122,7 +122,7 @@ def test_user_cli():
|
|||||||
|
|
||||||
with TestRun.step("Try to zero metadata."):
|
with TestRun.step("Try to zero metadata."):
|
||||||
try:
|
try:
|
||||||
output = run_as_other_user(cli.zero_metadata_cmd(str(cache_dev)), user_name)
|
output = run_as_other_user(cli.zero_metadata_cmd(str(cache_dev.path)), user_name)
|
||||||
if output.exit_code == 0:
|
if output.exit_code == 0:
|
||||||
TestRun.LOGGER.error("Zeroing metadata should fail!")
|
TestRun.LOGGER.error("Zeroing metadata should fail!")
|
||||||
except CmdException:
|
except CmdException:
|
||||||
@ -354,10 +354,12 @@ def test_user_cli():
|
|||||||
|
|
||||||
with TestRun.step("Try to zero metadata with 'sudo'."):
|
with TestRun.step("Try to zero metadata with 'sudo'."):
|
||||||
try:
|
try:
|
||||||
run_as_other_user(cli.zero_metadata_cmd(str(cache_dev)),
|
output = run_as_other_user(cli.zero_metadata_cmd(str(cache_dev.path)), user_name, True)
|
||||||
user_name, True)
|
if output.exit_code == 0:
|
||||||
|
TestRun.LOGGER.error("Zeroing metadata with 'sudo' on running cache should fail!")
|
||||||
except CmdException:
|
except CmdException:
|
||||||
TestRun.LOGGER.error("Non-root sudoer user should be able to zero metadata.")
|
TestRun.LOGGER.info("Non-root sudoer user should be able to run zero metadata command "
|
||||||
|
"but the command should fail (expected).")
|
||||||
|
|
||||||
with TestRun.step("Try to print help for casadm with 'sudo'."):
|
with TestRun.step("Try to print help for casadm with 'sudo'."):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user