DAOS-XXXXX test: refactor NLT to make it more readable and its results easier to understand - #18808
DAOS-XXXXX test: refactor NLT to make it more readable and its results easier to understand#18808mchaarawi wants to merge 4 commits into
Conversation
|
Errors are Title of PR is too long,Ticket number suffix is not a number. See https://daosio.atlassian.net/wiki/spaces/DC/pages/11133911069/Commit+Comments,Unable to load ticket data |
bf5cf16 to
9018ef1
Compare
9018ef1 to
f97406f
Compare
NLT was a single ~7,000-line script whose results were scattered across
JUnit xml, three warnings json files, valgrind xml and a raw log tarball,
so finding the one issue behind a CI failure meant cross-referencing
several artifacts. This reworks NLT for both readability and result
triage without changing what it tests or how CI invokes it.
Reporting: NLT now writes a single human-readable summary (nlt-summary.md,
also printed to the console and archived by CI). It lists the verdict and
counts, each failed test with the DFuse/DAOS log lines that caused it
quoted inline plus a logfile:line reference, remaining log-analysis
findings grouped per test (with a server-wide group for shared-server
logs), valgrind notes and the slowest tests. Findings are correlated to
the owning test via a per-thread active-test context, since POSIX tests
run in parallel. The existing junit/json artifacts are unchanged for the
Jenkins plugins. Controlled by --summary (default on, "" disables).
Suites: add --suite {ci,manual,all}. Tests too slow or disk-hungry for CI
(stable_cont_inode, test_dfs_check, test_alloc_pil4dfs_ls) are no longer
dead/commented code in the CI path; they run only under --suite manual|all.
xtest_stable_cont_inode is renamed manual_stable_cont_inode and discovered
via PosixTests.generate_manual_test_list(); --test list shows a manual
section.
Structure: split node_local_test.py into a dependency-ordered nlt/ package
(base, config, reporting, logging_utils, client, server, dfuse, helpers,
posix_tests, fault_injection, special_tests, runner, cli). node_local_test.py
is now a thin shim so ci/unit scripts and developer invocation are
unchanged. Add utils/nlt/README.md, include the package in .dockerignore,
and archive nlt-summary.md from the NLT and Fault-injection stages.
Skip-unit-test: true
Skip-func-test-vm: true
skip-test-hardware: true
skip-unit-test-memcheck: true
skip-unit-test-bdev: true
Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@hpe.com>
f97406f to
1c99c98
Compare
daltonbohning
left a comment
There was a problem hiding this comment.
How do you feel about moving utils/nlt to src/tests/nlt?
yea i guess that makes sense |
Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@hpe.com>
|
@mchaarawi: Interesting... Long overdue! Do you want me to look at reworking #18779 as a PR for this? I think with your fix for the deadlock issue it will be less important to get the watchdog landed, but I think it would be super useful to have going forward. |
yes that makes sense and would be appreciated if i don't have to rebase this PR. |
Skip-unit-test: true skip-unit-test-memcheck: true skip-unit-test-bdev: true skip-functional: true Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@hpe.com>
dc991de to
916e013
Compare
daltonbohning
left a comment
There was a problem hiding this comment.
Still working through this. Nothing blocking so far. Just leaving comments for future improvements.
| # The NLT implementation lives in src/tests/nlt; ship it preserving the relative path so the | ||
| # utils/node_local_test.py shim can import it. | ||
| rsync -R -rlpt -z -e "ssh $SSH_KEY_ARGS" src/tests/nlt jenkins@"$NODE":build/ |
There was a problem hiding this comment.
Future: we could define NLT more as a package so this is not necessary
| elif size.endswith('GiB'): | ||
| size = int(size[:-3]) | ||
| size *= (1024 * 1024 * 1024) | ||
| self.max_log_size = int(size) |
There was a problem hiding this comment.
Future: catch ValueError and raise a more clear exception
| break | ||
| file_self = os.path.dirname(file_self) | ||
| if file_self == '/': | ||
| raise NLTestFail('build file not found') |
There was a problem hiding this comment.
Nit
| raise NLTestFail('build file not found') | |
| raise NLTestFail('.build_vars.json file not found') |
| rc = run_daos_cmd(conf, cmd) | ||
|
|
||
| assert rc.returncode == 0 | ||
|
|
||
| print(rc) |
There was a problem hiding this comment.
Nit: maybe should print before asserting in case there is useful info for debug
| try: | ||
| self._outputs[thread_id] += value | ||
| except KeyError: | ||
| self._outputs[thread_id] = value |
There was a problem hiding this comment.
Future: maybe make sure value is the expected type because technically this could happen and would error
write(4) # valid
write('string') # cannot int + str
| """Setup and import the log tracing code""" | ||
| # Try and pick this up from the src tree if possible; src/tests/ is the parent of this package. | ||
| file_self = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
| logparse_dir = join(file_self, 'ftest/cart/util') |
There was a problem hiding this comment.
Future: NLT using a file under ftest implies that file should not live under ftest
| return "%.1f%s%s" % (num, 'Yi', suffix) | ||
|
|
||
| if os.path.exists(f'{filename}.old'): | ||
| raise NLTestFail('Log file exceeded max size') |
There was a problem hiding this comment.
Nit. Include name
| raise NLTestFail('Log file exceeded max size') | |
| raise NLTestFail(f'Log file exceeded max size: {filename}') |
| from .base import get_active_test | ||
|
|
||
|
|
||
| class WarningsFactory(): |
There was a problem hiding this comment.
Future: generally more exception handling in helper functions.
| text = '\n'.join(lines) + '\n' | ||
| with open(filename, 'w') as sfd: | ||
| sfd.write(text) |
There was a problem hiding this comment.
Future: check if lines is large enough to warrant using sfd.writelines instead
| if args.suite == 'manual': | ||
| raw_test_list = PosixTests.generate_manual_test_list() | ||
| elif args.suite == 'all': | ||
| raw_test_list = PosixTests.generate_test_list() + PosixTests.generate_manual_test_list() | ||
| else: | ||
| raw_test_list = PosixTests.generate_test_list() |
There was a problem hiding this comment.
Nit: explicitly handle ci case and error otherwise
Skip-unit-test: true skip-unit-test-memcheck: true skip-unit-test-bdev: true skip-functional: true Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@hpe.com>
NLT was a single ~7,000-line script whose results were scattered across JUnit xml, three warnings json files, valgrind xml and a raw log tarball, so finding the one issue behind a CI failure meant cross-referencing several artifacts. This reworks NLT for both readability and result triage without changing what it tests or how CI invokes it.
Reporting: NLT now writes a single human-readable summary (nlt-summary.md, also printed to the console and archived by CI). It lists the verdict and counts, each failed test with the DFuse/DAOS log lines that caused it quoted inline plus a logfile:line reference, remaining log-analysis findings grouped per test (with a server-wide group for shared-server logs), valgrind notes and the slowest tests. Findings are correlated to the owning test via a per-thread active-test context, since POSIX tests run in parallel. The existing junit/json artifacts are unchanged for the Jenkins plugins. Controlled by --summary (default on, "" disables).
Suites: add --suite {ci,manual,all}. Tests too slow or disk-hungry for CI (stable_cont_inode, test_dfs_check, test_alloc_pil4dfs_ls) are no longer dead/commented code in the CI path; they run only under --suite manual|all. xtest_stable_cont_inode is renamed manual_stable_cont_inode and discovered via PosixTests.generate_manual_test_list(); --test list shows a manual section.
Structure: split node_local_test.py into a dependency-ordered nlt/ package (base, config, reporting, logging_utils, client, server, dfuse, helpers, posix_tests, fault_injection, special_tests, runner, cli). node_local_test.py is now a thin shim so ci/unit scripts and developer invocation are unchanged. Add utils/nlt/README.md, include the package in .dockerignore, and archive nlt-summary.md from the NLT and Fault-injection stages.
skip-test-hardware: true
Steps for the author:
After all prior steps are complete: