Skip to content

Commit

Permalink
DAOS-15778 test: remove DataMoverTestBase.posix_local_test_paths (#14802
Browse files Browse the repository at this point in the history
) (#15262)

remove DataMoverTestBase.posix_local_test_paths in favor of local
references

Signed-off-by: Dalton Bohning <[email protected]>
  • Loading branch information
daltonbohning authored Oct 9, 2024
1 parent 6673515 commit f65edd6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 37 deletions.
36 changes: 18 additions & 18 deletions src/tests/ftest/datamover/negative.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -134,41 +134,41 @@ 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")

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")
Expand All @@ -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),
Expand Down Expand Up @@ -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")
Expand Down
25 changes: 6 additions & 19 deletions src/tests/ftest/util/data_mover_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}'"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f65edd6

Please sign in to comment.