Closed Bug 605306 Opened 15 years ago Closed 14 years ago

[tracking] make all unittests pass

Categories

(Socorro :: General, task, P1)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rhelmer, Assigned: rhelmer)

References

()

Details

Attachments

(4 files, 1 obsolete file)

We are close to having all unittest pass on Hudson. I've examined the few remaining and I think they should be disabled (will have a patch for this momentarily). Once all unittests pass, we can focus on improving code coverage and not breaking existing tests (unless they are broken and/or useless, in which case we should disable or remove them as needed).
I've added FIXME comments in there about what the problems seem to be. There appears to be only one test that needs an HBase server to test against (testHbaseResubmit.py), we made an exception for PostgreSQL since so many things need it and it's relatively easy to install, but I suggest we instead mock the thrift connection. For what it's worth, I'd like to move the PostgreSQL connections to use mocks too but it's a sizable amount of work at this point, and having somewhat suboptimal tests is way better than having no tests.
Attachment #484126 - Flags: review?(lars)
Attachment #484126 - Flags: review?(lars) → review+
Sending socorro/unittest/cron/testDailyUrl.py Sending socorro/unittest/cron/testHbaseResubmit.py Sending socorro/unittest/lib/testStats.py Transmitting file data ... Committed revision 2653.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Regressed because 1.7reversion branch has been copied to trunk; I'll redo the patch against the new trunk.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
(In reply to comment #5) > Regressed because 1.7reversion branch has been copied to trunk; I'll redo the > patch against the new trunk. s/has been copied to/will be copied to/ There were some unexpected failures, all around the postgresql (non-mock) test: CRITICAL: relation "productdims" does not exist This might be some intermittent problem in the tests.
unit tests fixes: * set PYTHONPATH correctly * only clobber unittest configs in hudson target * call phpunit from coverage targets too
Attachment #491281 - Flags: review?(laura)
Updated since attachment 491277 [details] [diff] [review] landed already.
Attachment #491281 - Attachment is obsolete: true
Attachment #491285 - Flags: review?(laura)
Attachment #491281 - Flags: review?(laura)
Attachment #491285 - Flags: review?(laura) → review+
Comment on attachment 491285 [details] [diff] [review] simplify coverage, pass PYTHONPATH consistently Thanks! Sending Makefile Transmitting file data . Committed revision 2727.
It looks like we have at least one intermittent test: https://hudson.mozilla.org/job/socorro/lastCompletedBuild/testReport/socorro.unittest.processor.testProcessor/TestProcessor/testSubmitJobToThreads/ We've also seen it hang a few times, not sure if this is the unit test hanging or some problem in Hudson, but we can abort from Hudson so I am guessing it's the test getting into a loop or something: https://hudson.mozilla.org/job/socorro/155/console https://hudson.mozilla.org/job/socorro/158/console
I've seen unit tests hang when they are testing a multithreaded component and an assert fails. The assertion exception gets raised and bounces execution beyond the multithreaded components cleanup/join code. The solution is to make sure that all tests that involve multithreaded components use a try:finally: block to ensure that the cleanup/join code gets run after an assertion failure. I've not yet looked to see if that is true in your reported cases...
Another hang in testProcessor: https://hudson.mozilla.org/job/socorro/165/console I'm going to disable that one, and run it in a loop locally to see if I can reproduce. (In reply to comment #12) > I've seen unit tests hang when they are testing a multithreaded component and > an assert fails. The assertion exception gets raised and bounces execution > beyond the multithreaded components cleanup/join code. The solution is to make > sure that all tests that involve multithreaded components use a try:finally: > block to ensure that the cleanup/join code gets run after an assertion failure. > > I've not yet looked to see if that is true in your reported cases... This does sound consistent with the behaviors we've seen (intermittent failure, and intermittent hang). I'll take a peek while I try to repro it locally.
(In reply to comment #13) > Another hang in testProcessor: > > https://hudson.mozilla.org/job/socorro/165/console I take that back - it looks like it was actually socorro.unittest.lib.testJsonDumpStorage that was hanging.
(In reply to comment #14) > (In reply to comment #13) > > Another hang in testProcessor: > > > > https://hudson.mozilla.org/job/socorro/165/console > > I take that back - it looks like it was actually > socorro.unittest.lib.testJsonDumpStorage that was hanging. So the reason I am confused here is that when I looked while it was hanging, it appeared, "socorro.unittest.lib.testJsonDumpStorage" was the last test output we had.. looking at the console output after aborting, it looks more like it was socorro.unittest.processor.testProcessor, I am guessing this is due to stdout/stderr buffering by Hudson. Anyway, I am going to assume the problem is socorro.unittest.processor.testProcessor for now, and focus on that for a while.
Here is one I haven't seen before: https://hudson.mozilla.org/job/socorro/243/testReport/junit/socorro.unittest.cron.testSignatureProductdims/TestSignatureProductdims/testPopulateSignatureProductdims/ Error Message day is out of range for month -------------------- >> begin captured logging << -------------------- builds: INFO: There were no priority_job tables to close --------------------- >> end captured logging << --------------------- Stacktrace Traceback (most recent call last): File "/usr/lib/python2.6/unittest.py", line 279, in run testMethod() File "/var/lib/hudson/jobs/socorro/workspace/trunk/socorro/unittest/cron/testSignatureProductdims.py", line 163, in testPopulateSignatureProductdims makeBogusSignatureProductdims(me.conn, me.cur) File "/var/lib/hudson/jobs/socorro/workspace/trunk/socorro/unittest/cron/testSignatureProductdims.py", line 42, in makeBogusSignatureProductdims window_end = datetime.datetime(today.year, today.month, today.day - 1, 2, 0, 0).isoformat(' ') ValueError: day is out of range for month -------------------- >> begin captured logging << -------------------- builds: INFO: There were no priority_job tables to close --------------------- >> end captured logging << ---------------------
Busted date math. :) You probably want to change that to something like: window_end = datetime.datetime.fromordinal((today - datetime.timedelta(days=1)).toordinal())
Depends on: 631432
Depends on: 631433
Depends on: 631434
Tracking failures in this bug is a little messy; let's use it for tracking. Once we're consistently green, let's close this out and just file individual bugs for different failures as appropriate.
Status: REOPENED → ASSIGNED
No longer depends on: 631432, 631433, 631434
Summary: make all unittests pass → [tracking] make all unittests pass
Depends on: 631432, 631433, 631434
(In reply to comment #18) > Tracking failures in this bug is a little messy; let's use it for tracking. Er.. that didn't come out right :) ITIM: Let's use this as a "tracking bug" instead of trying to solve problems in comments.
Depends on: 634684
Depends on: 636608
We've been green for a while, and stage now only pulls builds that pass all unittests which gives us an incentive to stay that way ;)
Status: ASSIGNED → RESOLVED
Closed: 15 years ago14 years ago
Priority: -- → P1
Resolution: --- → FIXED
Component: Socorro → General
Product: Webtools → Socorro
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: