Skip to content

Commit

Permalink
DAOS-14541 test: remove redundant write_objects_wo_failon (#13218)
Browse files Browse the repository at this point in the history
Test-tag: BoundaryPoolContainerSpace DaosObjectQuery DmgSystemCleanupTest PoolServicesFaultInjection NvmeObject PoolEvictTest RbldBasic RbldCascadingFailures RbldContainerCreate RbldDeleteObjects RbldReadArrayTest EcodOfflineRebuildSingle  EcodDisabledRebuildSingle test_container_redundancy_factor_oclass_enforcement RbldContRfTest container,pr,vm pool,pr,vm
Skip-unit-tests: true
Skip-fault-injection-test: true

- Remove TestContainer.write_objects_wo_failon
  - Update calles to use TestContainer.write_objects
- Remove fail_on from TestContainer.write_objects
  - Update tests appropriately
- Remove unused TestContainer.get_prop_values
- Remove unused TestPool.get_prop_values

Required-githooks: true

Signed-off-by: Dalton Bohning <dalton.bohning@intel.com>
  • Loading branch information
daltonbohning committed Jan 18, 2024
1 parent f13844d commit a7dddf8
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 80 deletions.
5 changes: 2 additions & 3 deletions src/tests/ftest/container/fill_destroy_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import os

from apricot import TestWithServers
from avocado.core.exceptions import TestFail
from general_utils import bytes_to_human, human_to_bytes
from general_utils import DaosTestError, bytes_to_human, human_to_bytes
from run_utils import run_remote


Expand Down Expand Up @@ -96,7 +95,7 @@ def write_pool_until_nospace(self, test_loop):

try:
container.write_objects()
except TestFail as excep:
except DaosTestError as excep:
if self.DER_NOSPACE in str(excep):
self.log.info(
"--%i.(4)DER_NOSPACE %s detected, pool is unable for an additional"
Expand Down
6 changes: 3 additions & 3 deletions src/tests/ftest/control/dmg_system_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from socket import gethostname

from apricot import TestWithServers
from avocado.core.exceptions import TestFail
from general_utils import DaosTestError
from pydaos.raw import DaosPool


Expand Down Expand Up @@ -62,7 +62,7 @@ def test_dmg_system_cleanup_one_host(self):
try:
for idx in range(2):
self.container[idx].write_objects()
except TestFail as error:
except DaosTestError as error:
self.fail("Unable to write container #{}: {}\n".format(idx, error))

# Call dmg system cleanup on the host and create cleaned pool list.
Expand All @@ -78,7 +78,7 @@ def test_dmg_system_cleanup_one_host(self):
for idx in range(2):
try:
self.container[idx].write_objects()
except TestFail as error:
except DaosTestError as error:
self.log.info("Unable to write container #%d: as expected %s\n", idx, error)
else:
self.fail("Wrote to container #{} when it should have failed".format(idx))
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/pool/evict.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from apricot import TestWithServers
from avocado.core.exceptions import TestFail
from ClusterShell.NodeSet import NodeSet
from general_utils import DaosTestError
from pydaos.raw import DaosApiError, c_uuid_to_str


Expand Down Expand Up @@ -205,7 +205,7 @@ def test_pool_evict(self):
if failure_expected:
self.fail(
"Pool {} was evicted, but write_objects worked!".format(index))
except TestFail as error:
except DaosTestError as error:
if failure_expected and "-1002" in str(error):
msg = "Pool # {}: write_objects failed as expected.\n\t{}".format(
index, error)
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/rebuild/container_create_race.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from avocado.core.exceptions import TestFail
from general_utils import DaosTestError
from ior_test_base import IorTestBase


Expand Down Expand Up @@ -67,7 +67,7 @@ def access_container(self, index=-1):
try:
container.read_objects()
container.close()
except TestFail as error:
except DaosTestError as error:
self.log.error("=> Container %s read failed:", container, exc_info=error)
status = False
return status
Expand Down
2 changes: 1 addition & 1 deletion src/tests/ftest/util/container_rf_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def create_test_container_and_write_obj(self, negative_test=False):
self.inputs.rank.value[0], self.inputs.object_class.value)
else:
try:
self.container.write_objects_wo_failon(
self.container.write_objects(
self.inputs.rank.value[0], self.inputs.object_class.value)
self.fail("#Container redundancy factor with an invalid "
"object_class traffic passed, expecting Fail")
Expand Down
46 changes: 0 additions & 46 deletions src/tests/ftest/util/test_utils_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,31 +620,6 @@ def check_container_info(self, ci_uuid=None, ci_nsnapshots=None, ci_nhandles=Non
if key != "self" and val is not None]
return self._check_info(checks)

def write_objects_wo_failon(self, rank=None, obj_class=None):
"""Write objects to the container without fail_on DaosTestError,
for negative test on container write_objects.
Args:
rank (int, optional): server rank. Defaults to None.
obj_class (int, optional): daos object class. Defaults to None.
"""
self.open()
self.log.info(
"Writing %s object(s), with %s record(s) of %s bytes(s) each, in "
"container %s%s%s",
self.object_qty.value, self.record_qty.value, self.data_size.value,
str(self), " on rank {}".format(rank) if rank is not None else "",
" with object class {}".format(obj_class)
if obj_class is not None else "")
for _ in range(self.object_qty.value):
self.written_data.append(TestContainerData(self.debug.value))
self.written_data[-1].write_object(
self, self.record_qty.value, self.akey_size.value,
self.dkey_size.value, self.data_size.value, rank, obj_class,
self.data_array_size.value)

@fail_on(DaosTestError)
def write_objects(self, rank=None, obj_class=None):
"""Write objects to the container.
Expand All @@ -671,7 +646,6 @@ def write_objects(self, rank=None, obj_class=None):
self.dkey_size.value, self.data_size.value, rank, obj_class,
self.data_array_size.value)

@fail_on(DaosTestError)
def read_objects(self, txn=None):
"""Read the objects from the container and verify they match.
Expand Down Expand Up @@ -981,26 +955,6 @@ def get_prop(self, *args, **kwargs):
return self.daos.container_get_prop(
pool=self.pool.identifier, cont=self.identifier, *args, **kwargs)

def get_prop_values(self, *args, **kwargs):
"""Get container property values by calling daos container get-prop.
Args:
args (tuple, optional): positional arguments to DaosCommand.container_get_prop
kwargs (dict, optional): named arguments to DaosCommand.container_get_prop
Returns:
list: a list of values matching the or specified property names.
"""
values = []
self.log.info("Getting property values for container %s", self)
data = self.get_prop(*args, **kwargs)
if data['status'] != 0:
return values
for entry in data['response']:
values.append(entry['value'])
return values

def verify_prop(self, expected_props):
"""Verify daos container get-prop returns expected values.
Expand Down
23 changes: 0 additions & 23 deletions src/tests/ftest/util/test_utils_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,29 +639,6 @@ def get_prop(self, *args, **kwargs):
"""
return self.dmg.pool_get_prop(self.identifier, *args, **kwargs)

def get_prop_values(self, *args, **kwargs):
"""Get pool property values from the dmg pool get-prop json output.
Args:
args (tuple, optional): positional arguments to DmgCommand.pool_get_prop
kwargs (dict, optional): named arguments to DmgCommand.pool_get_prop
Raises:
TestFailure: if there is an error running dmg pool get-prop
Returns:
list: a list of values matching the or specified property names.
"""
values = []
self.log.info("Getting property values for %s", self)
data = self.get_prop(*args, **kwargs)
if data['status'] != 0:
return values
for entry in data['response']:
values.append(entry['value'])
return values

@fail_on(CommandFailure)
def get_property(self, prop_name):
"""Get the pool property with the specified name.
Expand Down

0 comments on commit a7dddf8

Please sign in to comment.