-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DAOS-13886 test: Fix system name validation #12570
Changes from 5 commits
a233d3f
0b25e73
3398316
63a2313
b5aede8
c94bb40
ce83191
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,32 +22,69 @@ class DAOSVersion(TestWithServers): | |
def __init__(self, *args, **kwargs): | ||
"""Initialize a DAOSVersion object.""" | ||
super().__init__(*args, **kwargs) | ||
|
||
# Don't waste time starting servers and agents. | ||
self.setup_start_servers = False | ||
self.setup_start_agents = False | ||
|
||
self.errors = [] | ||
|
||
def report_result(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fact, I have done it this way, to keep the same behavior as it was originally done in the PR.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed with PR #12615 |
||
"""Helper printing test result""" | ||
self.log.info("###### Test Result ######") | ||
report_errors(test=self, errors=self.errors) | ||
self.log.info("#########################") | ||
|
||
def append_error(self, title, details): | ||
"""Helper adding an error to the list of errors | ||
|
||
Args: | ||
title (str): Error message title | ||
details (list): List of string of the error details | ||
""" | ||
msg = title | ||
if details: | ||
msg += "\n\t" + "\n\t".join(details) | ||
self.errors.append(msg) | ||
|
||
def test_version(self): | ||
"""Verify version number for dmg, daos, daos_server, and daos_agent against RPM. | ||
|
||
:avocado: tags=all,full_regression | ||
:avocado: tags=vm | ||
:avocado: tags=control,daos_cmd | ||
:avocado: tags=version_number,test_version | ||
:avocado: tags=DAOSVersion,test_version | ||
""" | ||
errors = [] | ||
|
||
# Get RPM version. | ||
rpm_command = "rpm -qa|grep daos-server" | ||
output = run_pcmd(hosts=self.hostlist_servers, command=rpm_command) | ||
self.log.info("RPM output = %s", output) | ||
stdout = output[0]["stdout"][0] | ||
self.log.info("RPM stdout = %s", stdout) | ||
result = re.findall(r"daos-server-[tests-|tests_openmpi-]*([\d.]+)", stdout) | ||
self.log.debug("RPM output = %s", output) | ||
rc = output[0]["exit_status"] | ||
stdout = output[0]["stdout"] | ||
if rc != 0: | ||
msg = "DAOS RPMs not properly installed: rc={}".format(rc) | ||
self.append_error(msg, stdout) | ||
self.report_result() | ||
rpm_version = None | ||
for rpm in stdout: | ||
result = re.findall(r"daos-server-[tests-|tests_openmpi-]*([\d.]+)", rpm) | ||
if result: | ||
rpm_version = result[0] | ||
break | ||
if not result: | ||
errors.append("RPM version is not in the output! {}".format(output)) | ||
else: | ||
rpm_version = result[0] | ||
self.log.info("RPM version = %s", rpm_version) | ||
msg = "RPM version could not be defined" | ||
self.append_error(msg, stdout) | ||
self.report_result() | ||
self.log.info("RPM version = %s", rpm_version) | ||
knard-intel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Remove configuration files | ||
cleanup_cmds = [ | ||
"sudo find /etc/daos/certs -type f -delete -print", | ||
"sudo rm -fv /etc/daos/daos_server.yml /etc/daos/daos_control.yml" | ||
" /etc/daos/daos_agent.yml", | ||
] | ||
for cmd in cleanup_cmds: | ||
run_pcmd(hosts=self.hostlist_servers, command=cmd) | ||
Comment on lines
+80
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we need to run this test w/o certificates, the preferred method is to use the following test yaml entries:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add these config parameters in a follow up PR as this one has been already merged.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed with PR #12615 |
||
|
||
# Get dmg version. | ||
dmg_version = self.get_dmg_command().version()["response"]["version"] | ||
|
@@ -58,10 +95,19 @@ def test_version(self): | |
self.log.info("daos version = %s", daos_version) | ||
|
||
# Get daos_agent version. | ||
daos_agent_version = None | ||
daos_agent_cmd = "daos_agent --json version" | ||
output = run_pcmd(hosts=self.hostlist_servers, command=daos_agent_cmd) | ||
daos_agent_version = json.loads("".join(output[0]["stdout"]))["response"]["version"] | ||
self.log.info("daos_agent version = %s", daos_agent_version) | ||
self.log.debug("DAOS Agent output = %s", output) | ||
rc = output[0]["exit_status"] | ||
stdout = output[0]["stdout"] | ||
if rc != 0: | ||
msg = "DAOS Agent not properly installed: rc={}".format(rc) | ||
self.append_error(msg, stdout) | ||
else: | ||
self.log.info("DAOS Agent stdout = %s", "".join(stdout)) | ||
daos_agent_version = json.loads("".join(stdout))["response"]["version"] | ||
self.log.info("daos_agent version = %s", daos_agent_version) | ||
|
||
# Get daos_server version | ||
daos_server_cmd = DaosServerCommandRunner(path=self.bin) | ||
|
@@ -82,8 +128,6 @@ def test_version(self): | |
if version != rpm_version: | ||
msg = "Unexpected version! {} = {}, RPM = {}".format( | ||
tool, version, rpm_version) | ||
errors.append(msg) | ||
self.errors.append(msg) | ||
|
||
self.log.info("###### Test Result ######") | ||
report_errors(test=self, errors=errors) | ||
self.log.info("#########################") | ||
self.report_result() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should expand the coverage to cover special characters and over length, the reason this now fails is because there is a new length requirement introduced by 0b5cdc0 which limits to 15 chars.
I suggest reducing the value in this test case to 15 chars (which should pass even with special characters) and leaving the expectation as "PASS". Then add another
name_links_exceeded
test case with the original value which should result in a failure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tanabarr pushed the commit ce83191 to update the unit tests in this way 😸