Skip to content

tools: fix type mismatch in test runner#38289

Merged
richardlau merged 1 commit intonodejs:masterfrom
richardlau:testrunner
Apr 21, 2021
Merged

tools: fix type mismatch in test runner#38289
richardlau merged 1 commit intonodejs:masterfrom
richardlau:testrunner

Conversation

@richardlau
Copy link
Member

output.diagnostic is a list that is appended to on SmartOS when retrying a test due to ECONNREFUSED.

self.diagnostic = []

node/tools/test.py

Lines 197 to 204 in 2853b76

# SmartOS has a bug that causes unexpected ECONNREFUSED errors.
# See https://smartos.org/bugview/OS-2767
# If ECONNREFUSED on SmartOS, retry the test one time.
if (output.UnexpectedOutput() and
sys.platform == 'sunos5' and
'ECONNREFUSED' in output.output.stderr):
output = case.Run()
output.diagnostic.append('ECONNREFUSED received, test retried')

The test runner checks if output.diagnostic is truthy and, if so, assigns its value to self.traceback.

node/tools/test.py

Lines 376 to 378 in 2853b76

if output.diagnostic:
self.severity = 'ok'
self.traceback = output.diagnostic

However self.traceback is supposed to be a string, and _printDiagnostic() in the TapProgressIndicator attempts to call splitlines() on it, which fails if it is a list with:

AttributeError: 'list' object has no attribute 'splitlines'

node/tools/test.py

Lines 318 to 324 in 2853b76

def _printDiagnostic(self):
logger.info(' severity: %s', self.severity)
self.exitcode and logger.info(' exitcode: %s', self.exitcode)
logger.info(' stack: |-')
for l in self.traceback.splitlines():
logger.info(' ' + l)

Seen in https://ci.nodejs.org/job/node-test-commit-smartos/nodes=smartos18-64/38562/console

23:20:25 ok 2976 pummel/test-net-connect-econnrefused
23:20:33   ---
23:20:33   duration_ms: 8.617
23:20:33   severity: ok
23:20:33   stack: |-
23:20:33 Traceback (most recent call last):
23:20:33   File "tools/test.py", line 1753, in <module>
23:20:33     sys.exit(Main())
23:20:33   File "tools/test.py", line 1729, in Main
23:20:33     if RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests):
23:20:33   File "tools/test.py", line 951, in RunTestCases
23:20:33     return progress.Run(tasks)
23:20:33   File "tools/test.py", line 160, in Run
23:20:33     self.RunSingle(False, 0)
23:20:33   File "tools/test.py", line 221, in RunSingle
23:20:33     self.HasRun(output)
23:20:33   File "tools/test.py", line 395, in HasRun
23:20:33     self._printDiagnostic()
23:20:33   File "tools/test.py", line 323, in _printDiagnostic
23:20:33     for l in self.traceback.splitlines():
23:20:33 AttributeError: 'list' object has no attribute 'splitlines'
23:20:33 make[1]: *** [Makefile:516: test-ci] Error 1

cc @nodejs/python

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. smartos Issues and PRs related to the SmartOS platform. test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants