From f65edd65ca38b6d31e199d6e0251c593557ab70d Mon Sep 17 00:00:00 2001 From: Dalton Bohning Date: Wed, 9 Oct 2024 07:33:58 -0700 Subject: [PATCH] DAOS-15778 test: remove DataMoverTestBase.posix_local_test_paths (#14802) (#15262) remove DataMoverTestBase.posix_local_test_paths in favor of local references Signed-off-by: Dalton Bohning --- src/tests/ftest/datamover/negative.py | 36 ++++++++++---------- src/tests/ftest/util/data_mover_test_base.py | 25 ++++---------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/src/tests/ftest/datamover/negative.py b/src/tests/ftest/datamover/negative.py index f3891045d86..67f6f2f53e5 100644 --- a/src/tests/ftest/datamover/negative.py +++ b/src/tests/ftest/datamover/negative.py @@ -33,13 +33,13 @@ def setUp(self): super().setUp() # Get the parameters - self.test_file = self.ior_cmd.test_file.value + test_file = self.ior_cmd.test_file.value # Setup the directory structures - self.new_posix_test_path() - self.posix_test_file = join(self.posix_local_test_paths[0], self.test_file) - self.daos_test_path = "/" - self.daos_test_file = join(self.daos_test_path, self.test_file) + self.__posix_test_path = self.new_posix_test_path() + self.__posix_test_file = join(self.__posix_test_path, test_file) + self.__daos_test_path = "/" + self.__daos_test_file = join(self.__daos_test_path, test_file) def test_dm_bad_params_dcp(self): """Jira ID: DAOS-5515 - Initial test case. @@ -75,27 +75,27 @@ def test_dm_bad_params_dcp(self): cont1 = self.get_container(pool1, path=cont1_path) # Create test files - self.run_ior_with_params("POSIX", self.posix_test_file) - self.run_ior_with_params("DAOS_UUID", self.daos_test_file, pool1, cont1) + self.run_ior_with_params("POSIX", self.__posix_test_file) + self.run_ior_with_params("DAOS_UUID", self.__daos_test_file, pool1, cont1) # Bad parameter: required arguments. self.run_datamover( self.test_id + " (missing source pool)", src_path=format_path(), - dst_path=self.posix_local_test_paths[0], + dst_path=self.__posix_test_path, expected_rc=1, expected_output=self.MFU_ERR_DAOS_INVAL_ARG) self.run_datamover( self.test_id + " (missing source cont)", src_path=format_path(pool1), - dst_path=self.posix_local_test_paths[0], + dst_path=self.__posix_test_path, expected_rc=1, expected_output=self.MFU_ERR_DAOS_INVAL_ARG) self.run_datamover( self.test_id + " (missing dest pool)", - src_path=self.posix_local_test_paths[0], + src_path=self.__posix_test_path, dst_path=format_path(), expected_rc=1, expected_output=self.MFU_ERR_DAOS_INVAL_ARG) @@ -134,20 +134,20 @@ def test_dm_bad_params_dcp(self): self.run_datamover( self.test_id + " (invalid source pool)", src_path=format_path(fake_uuid, cont1), - dst_path=self.posix_local_test_paths[0], + dst_path=self.__posix_test_path, expected_rc=1, expected_output="DER_NONEXIST") self.run_datamover( self.test_id + " (invalid source cont)", src_path=format_path(pool1, fake_uuid), - dst_path=self.posix_local_test_paths[0], + dst_path=self.__posix_test_path, expected_rc=1, expected_output="DER_NONEXIST") self.run_datamover( self.test_id + " (invalid dest pool)", - src_path=self.posix_local_test_paths[0], + src_path=self.__posix_test_path, dst_path=format_path(fake_uuid, cont1), expected_rc=1, expected_output="DER_NONEXIST") @@ -155,20 +155,20 @@ def test_dm_bad_params_dcp(self): self.run_datamover( self.test_id + " (invalid source cont path)", src_path=format_path(pool1, cont1, "/fake/fake"), - dst_path=self.posix_local_test_paths[0], + dst_path=self.__posix_test_path, expected_rc=1, expected_output="No such file or directory") self.run_datamover( self.test_id + " (invalid source cont UNS path)", src_path=cont1.path.value + "/fake/fake", - dst_path=self.posix_local_test_paths[0], + dst_path=self.__posix_test_path, expected_rc=1, expected_output="No such file or directory") self.run_datamover( self.test_id + " (invalid dest cont path)", - src_path=self.posix_local_test_paths[0], + src_path=self.__posix_test_path, dst_path=format_path(pool1, cont1, "/fake/fake"), expected_rc=1, expected_output="No such file or directory") @@ -188,7 +188,7 @@ def test_dm_bad_params_dcp(self): expected_output="No such file or directory") # (4) Bad parameter: destination filename is invalid. - dst_path = join(self.posix_local_test_paths[0], "d" * 300) + dst_path = join(self.__posix_test_path, "d" * 300) self.run_datamover( self.test_id + " (filename is too long)", src_path=format_path(pool1, cont1), @@ -225,7 +225,7 @@ def test_dm_bad_params_fs_copy(self): cont1 = self.get_container(pool1, path=cont1_path) # Create test files - self.run_ior_with_params("DAOS", self.daos_test_file, pool1, cont1) + self.run_ior_with_params("DAOS", self.__daos_test_file, pool1, cont1) # (1) Bad parameter: source is destination. self.log_step("Verify error when label source is label dest") diff --git a/src/tests/ftest/util/data_mover_test_base.py b/src/tests/ftest/util/data_mover_test_base.py index 64a330c09c8..4c0a278e50f 100644 --- a/src/tests/ftest/util/data_mover_test_base.py +++ b/src/tests/ftest/util/data_mover_test_base.py @@ -140,12 +140,6 @@ def __init__(self, *args, **kwargs): self.preserve_props_path = None - # List of local test paths to create and remove - self.posix_local_test_paths = [] - - # List of daos test paths to keep track of - self.daos_test_paths = [] - def setUp(self): """Set up each test case.""" # Start the servers and agents @@ -221,15 +215,10 @@ def new_posix_test_path(self, shared=False, create=True, parent=None, mount_dir_ str: the posix path. """ - # make directory name unique to datamover test - method = self.get_test_name() - dir_name = "{}{}".format(method, len(self.posix_local_test_paths)) + # make directory name unique to this test + dir_name = self.label_generator.get_label(self.get_test_name()) path = join(parent or self.posix_root.value, dir_name) - # Add to the list of posix paths - if not shared: - self.posix_local_test_paths.append(path) - if create: # Create the directory cmd = f"mkdir -p '{path}'" @@ -270,18 +259,16 @@ def new_daos_test_path(self, create=True, cont=None, parent="/"): str: the path relative to the root of the container. """ - dir_name = "daos_test{}".format(len(self.daos_test_paths)) + dir_name = self.label_generator.get_label('daos_test_dir') path = join(parent, dir_name) - # Add to the list of daos paths - self.daos_test_paths.append(path) - if create: if not cont or not cont.path: self.fail("Container path required to create directory.") # Create the directory relative to the container path - cmd = "mkdir -p '{}'".format(cont.path.value + path) - self.execute_cmd(cmd) + full_path = cont.path.value + path + if not run_remote(self.log, self.hostlist_clients, f"mkdir -p '{full_path}'").passed: + self.fail(f"Failed to mkdir {full_path}") return path