Skip to content

Commit

Permalink
DAOS-6932 tests: Resolving DmgCommand JSON parsing error (#4890)
Browse files Browse the repository at this point in the history
Resolving a JSON parsing encountered by the pool/create_test.py when
failing to create a pool by replacing the "combined" stdout/stderr
output currently produced by avocado's process.run() with the "both"
option.

Master-PR: #4858

Signed-off-by: Phillip Henderson <phillip.henderson@intel.com>
  • Loading branch information
phender authored Mar 5, 2021
1 parent f7de263 commit 87ef0a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/tests/ftest/util/command_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, namespace, command, path="", subprocess=False):
self.run_as_subprocess = subprocess
self.timeout = None
self.exit_status_exception = True
self.output_check = "both"
self.verbose = True
self.env = None
self.sudo = False
Expand Down Expand Up @@ -117,7 +118,7 @@ def _run_process(self):
# Block until the command is complete or times out
return run_command(
command, self.timeout, self.verbose, self.exit_status_exception,
"combined", env=self.env)
self.output_check, env=self.env)

except DaosTestError as error:
# Command failed or possibly timed out
Expand Down
3 changes: 3 additions & 0 deletions src/tests/ftest/util/dmg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ def _get_json_result(self, sub_command_list=None, **kwargs):
"""Wraps the base _get_result method to force JSON output."""
prev_json_val = self.json.value
self.json.update(True)
prev_output_check = self.output_check
self.output_check = "both"
try:
self._get_result(sub_command_list, **kwargs)
finally:
self.json.update(prev_json_val)
self.output_check = prev_output_check
return json.loads(self.result.stdout)

def network_scan(self, provider=None, all_devs=False):
Expand Down
4 changes: 2 additions & 2 deletions src/tests/ftest/util/general_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def bytes_to_human(size, digits=2, binary=True):


def run_command(command, timeout=60, verbose=True, raise_exception=True,
output_check="combined", env=None):
output_check="both", env=None):
"""Run the command on the local host.
This method uses the avocado.utils.process.run() method to run the specified
Expand All @@ -242,7 +242,7 @@ def run_command(command, timeout=60, verbose=True, raise_exception=True,
"both" - both standard output and error in separate files
"combined" - standard output and error in a single file
"none" - disable all recording
Defaults to "combined".
Defaults to "both".
env (dict, optional): dictionary of environment variable names and
values to set when running the command. Defaults to None.
Expand Down

0 comments on commit 87ef0a6

Please sign in to comment.