Skip to content
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

tools: fix type mismatch in test runner #38289

Merged
merged 1 commit into from Apr 21, 2021

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

@richardlau richardlau added the smartos Issues and PRs related to the SmartOS platform. label Apr 18, 2021
@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels Apr 18, 2021
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

tools/test.py Outdated Show resolved Hide resolved
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@richardlau richardlau added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Apr 19, 2021
`output.diagnostic` is a list that is appended to on SmartOS when
retrying a test due to `ECONNREFUSED`. The test runner checks if
`output.diagnostic` is truthy and, if so, assigns its value to
`self.traceback`. 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'

PR-URL: nodejs#38289
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@richardlau
Copy link
Member Author

Landed in e703ceb

@richardlau richardlau merged commit e703ceb into nodejs:master Apr 21, 2021
@richardlau richardlau deleted the testrunner branch April 21, 2021 20:46
targos pushed a commit that referenced this pull request Apr 29, 2021
`output.diagnostic` is a list that is appended to on SmartOS when
retrying a test due to `ECONNREFUSED`. The test runner checks if
`output.diagnostic` is truthy and, if so, assigns its value to
`self.traceback`. 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'

PR-URL: #38289
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@targos targos mentioned this pull request May 3, 2021
targos pushed a commit that referenced this pull request May 30, 2021
`output.diagnostic` is a list that is appended to on SmartOS when
retrying a test due to `ECONNREFUSED`. The test runner checks if
`output.diagnostic` is truthy and, if so, assigns its value to
`self.traceback`. 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'

PR-URL: #38289
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request Jun 5, 2021
`output.diagnostic` is a list that is appended to on SmartOS when
retrying a test due to `ECONNREFUSED`. The test runner checks if
`output.diagnostic` is truthy and, if so, assigns its value to
`self.traceback`. 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'

PR-URL: #38289
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request Jun 11, 2021
`output.diagnostic` is a list that is appended to on SmartOS when
retrying a test due to `ECONNREFUSED`. The test runner checks if
`output.diagnostic` is truthy and, if so, assigns its value to
`self.traceback`. 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'

PR-URL: #38289
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
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.

None yet

6 participants