Skip to content

DAOS-XXXXX test: refactor NLT to make it more readable and its results easier to understand - #18808

Draft
mchaarawi wants to merge 4 commits into
masterfrom
mschaara/nlt_refactor
Draft

DAOS-XXXXX test: refactor NLT to make it more readable and its results easier to understand#18808
mchaarawi wants to merge 4 commits into
masterfrom
mschaara/nlt_refactor

Conversation

@mchaarawi

Copy link
Copy Markdown
Contributor

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:

  • Commit message follows the guidelines.
  • Appropriate Features or Test-tag pragmas were used.
  • Appropriate Functional Test Stages were run.
  • At least two positive code reviews including at least one code owner from each category referenced in the PR.
  • Testing is complete. If necessary, forced-landing label added and a reason added in a comment.

After all prior steps are complete:

  • Gatekeeper requested (daos-gatekeeper added as a reviewer).

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

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
https://daosio.atlassian.net/browse/DAOS-XXXXX

@mchaarawi
mchaarawi force-pushed the mschaara/nlt_refactor branch from bf5cf16 to 9018ef1 Compare August 7, 2026 04:01
@mchaarawi mchaarawi changed the title DAOS-XXXXX test: make NLT readable and its results easy to understand DAOS-XXXXX test: refactor NLT to make it more readable and its results easier to understand Aug 7, 2026
@mchaarawi
mchaarawi force-pushed the mschaara/nlt_refactor branch from 9018ef1 to f97406f Compare August 7, 2026 13:52
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>
@mchaarawi
mchaarawi force-pushed the mschaara/nlt_refactor branch from f97406f to 1c99c98 Compare August 7, 2026 14:13

@daltonbohning daltonbohning left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about moving utils/nlt to src/tests/nlt?

@mchaarawi

Copy link
Copy Markdown
Contributor Author

How do you feel about moving utils/nlt to src/tests/nlt?

yea i guess that makes sense

Comment thread utils/nlt/base.py Outdated
Comment thread utils/nlt/base.py Outdated
Comment thread utils/nlt/cli.py Outdated
Comment thread utils/nlt/cli.py Outdated
Comment thread utils/nlt/cli.py Outdated
Comment thread utils/nlt/helpers.py Outdated
Signed-off-by: Mohamad Chaarawi <mohamad.chaarawi@hpe.com>
@mjmac

mjmac commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@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.

@mchaarawi

mchaarawi commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

@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.
please wait a little to get reviews/approval from all folks here on my PR so you wouldn't have to rebase a lot on requested changes.

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>
@mchaarawi
mchaarawi force-pushed the mschaara/nlt_refactor branch from dc991de to 916e013 Compare August 7, 2026 17:31

@daltonbohning daltonbohning left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still working through this. Nothing blocking so far. Just leaving comments for future improvements.

Comment thread ci/unit/test_nlt.sh
Comment on lines +21 to +23
# 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/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: we could define NLT more as a package so this is not necessary

Comment thread src/tests/nlt/config.py
elif size.endswith('GiB'):
size = int(size[:-3])
size *= (1024 * 1024 * 1024)
self.max_log_size = int(size)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: catch ValueError and raise a more clear exception

Comment thread src/tests/nlt/config.py Outdated
break
file_self = os.path.dirname(file_self)
if file_self == '/':
raise NLTestFail('build file not found')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit

Suggested change
raise NLTestFail('build file not found')
raise NLTestFail('.build_vars.json file not found')

Comment thread src/tests/nlt/helpers.py
Comment on lines +114 to +118
rc = run_daos_cmd(conf, cmd)

assert rc.returncode == 0

print(rc)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe should print before asserting in case there is useful info for debug

Comment on lines +33 to +36
try:
self._outputs[thread_id] += value
except KeyError:
self._outputs[thread_id] = value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: NLT using a file under ftest implies that file should not live under ftest

Comment thread src/tests/nlt/logging_utils.py Outdated
return "%.1f%s%s" % (num, 'Yi', suffix)

if os.path.exists(f'{filename}.old'):
raise NLTestFail('Log file exceeded max size')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. Include name

Suggested change
raise NLTestFail('Log file exceeded max size')
raise NLTestFail(f'Log file exceeded max size: {filename}')

from .base import get_active_test


class WarningsFactory():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: generally more exception handling in helper functions.

Comment on lines +357 to +359
text = '\n'.join(lines) + '\n'
with open(filename, 'w') as sfd:
sfd.write(text)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: check if lines is large enough to warrant using sfd.writelines instead

Comment thread src/tests/nlt/runner.py
Comment on lines +180 to +185
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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants