Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Broken CI #626

Closed
yajo opened this issue Jan 21, 2020 · 4 comments
Closed

Broken CI #626

yajo opened this issue Jan 21, 2020 · 4 comments

Comments

@yajo
Copy link
Member

yajo commented Jan 21, 2020

This repo is broken.

The tests exhibit some kind of race condition that sometimes makes builds fail.

You can see the failures in https://travis-ci.org/OCA/maintainer-quality-tools/builds/637822768, which are unrelated to the PR.

I just rebuilt one job in the master branch and it failed with the same failure: https://travis-ci.org/OCA/maintainer-quality-tools/jobs/623695176

The failure seems to come from around the combination of these code chunks, and has been probably introduced by @hugo-ad in #434:

# On TravisCI tests, force stopping the alive server
odoo_pid = open('/tmp/odoo.pid').read()
subprocess.call(['kill', '-9', odoo_pid])

for command, check_loaded in commands:
if db_odoo_created and instance_alive:
# If exists database of odoo test
# then start server with regular command without tests params
rm_items = [
'coverage', 'run', '--stop-after-init',
'--test-enable', '--init', None,
'--log-handler', 'openerp.tools.yaml_import:DEBUG',
]
command_call = [item
for item in commands[0][0]
if item not in rm_items] + \
['--pidfile=/tmp/odoo.pid']
else:
command[-1] = to_test
# Run test command; unbuffer keeps output colors
command_call = (["unbuffer"] if unbuffer else []) + command
print(" ".join(cmd_strip_secret(command_call)))
pipe = subprocess.Popen(command_call,
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE)
with open('stdout.log', 'wb') as stdout:
for line in iter(pipe.stdout.readline, b''):
stdout.write(line)
print(line.strip().decode(
'UTF-8', errors='backslashreplace'
))
returncode = pipe.wait()
# Find errors, except from failed mails
errors = has_test_errors(
"stdout.log", database, odoo_version, check_loaded)
if returncode != 0:
all_errors.append(to_test)
print(fail_msg, "Command exited with code %s" % returncode)
# If there are no errors,
# adds an error when returcode!=0
# because it's actually an error.
if not errors:
errors += 1
if errors:
counted_errors += errors
all_errors.append(to_test)
print(fail_msg, "Found %d lines with errors" % errors)
if not instance_alive and odoo_unittest:
# Don't drop the database if will be used later.
subprocess.call(["dropdb", database])

I have no idea on how to fix it, this is all the info I could get 😕

@pedrobaeza
Copy link
Member

@moylop260 you are one of the masters of this repo. Can you help?

@moylop260
Copy link
Contributor

I @yajo
Thank for your issue

FYI I see the error here:

I have created the following PR in order to verify it:

moylop260 added a commit to vauxoo-dev/maintainer-quality-tools that referenced this issue Jan 24, 2020
@yajo
Copy link
Member Author

yajo commented Jan 24, 2020

Just in case it helps, let me explain how I got to the conclusion I said in #626 (comment).

AFAICS, comparing the ❌ job with the latest ✔️ one, the main difference is here:

Job that failed:

test_modules_to_preinstall (__main__.MainTest) ... ok
test_pylint_check (__main__.MainTest)
Testing empty paths and pylint_run fix of: ... skipped 'Set LINT_CHECK'
test_travis_helpers (__main__.MainTest) ... ----------
ok

Job that succeeded:

test_modules_to_preinstall (__main__.MainTest) ... ok
----------
test_pylint_check (__main__.MainTest)
Testing empty paths and pylint_run fix of: ... skipped 'Set LINT_CHECK'
test_travis_helpers (__main__.MainTest) ... ('\x1b[1;31mFAIL\x1b[0;m', 'Command exited with code -9')
('\x1b[1;31mFAIL\x1b[0;m', 'Found 1 lines with errors')
Module test summary
('\x1b[1;31mFAIL\x1b[0;m', 'broken_module')
Expected 2 errors, found 1!
ok

I have searched and there seems to be nothing that exits with -9, but the closest one seems to be:

# On TravisCI tests, force stopping the alive server
odoo_pid = open('/tmp/odoo.pid').read()
subprocess.call(['kill', '-9', odoo_pid])

It's a weird way to kill the server. It would have made more sense to start it and stop it in the same test, or in the setup/teardown methods. Also, it seems like the server is expecting 1 more error than what it finds. That's why I said it seems a race condition (after all, nothing has changed recently in those parts of the code).

I hope it helps.

moylop260 added a commit to vauxoo-dev/maintainer-quality-tools that referenced this issue Feb 4, 2020
@moylop260
Copy link
Contributor

Fixed #627

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants