Closed Bug 957384 Opened 9 years ago Closed 8 years ago

Buildapi's tests don't pass

Categories

(Release Engineering :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dustin, Assigned: dustin)

References

Details

Attachments

(1 file)

It looks like the test suite hasn't been run in a long time.  One of the tests asserted, indirectly, that today was September 30, 2010.
And let's throw in here: BuildAPI's mq support doesn't have any tests.
Blocks: 863268
Attachment #8356875 - Flags: review?(catlee)
Comment on attachment 8356875 [details] [diff] [review]
testing-devel.patch

Review of attachment 8356875 [details] [diff] [review]:
-----------------------------------------------------------------

The code/tests look fine, but I simply can't make them run. I got through a errors by installing some modules, some of which should be added to setup.py I think: redis, mock(?), kombu, gviz_api (if possible - I'm not sure it is). But even with that I hit errors, including what seems to be hangs in some tests (look for ^C in the output below):
Failure: KeyError ('builds') ... ERROR
Failure: KeyError ('builds') ... ERROR
test_branch (buildapi.tests.functional.test_builds.TestBuildsController) ... ^Cok
test_branch2 (buildapi.tests.functional.test_builds.TestBuildsController) ... ^Cok
======================================================================
ERROR: Failure: KeyError ('builds')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/bhearsum/tmp/buildapi/buildapi/controllers/reports.py", line 23, in <module>
    from buildapi.model.slaves import GetSlaveDetailsReport, \
  File "/home/bhearsum/tmp/buildapi/buildapi/model/slaves.py", line 13, in <module>
    b = meta.status_db_meta.tables['builds']
KeyError: 'builds'
-------------------- >> begin captured logging << --------------------
pylons.configuration: DEBUG: Initializing configuration, package: 'buildapi'
routes.middleware: DEBUG: Initialized with method overriding = True, and path info altering = True
buildapi.lib.mq: INFO: Lost connection, trying again in 1s
Traceback (most recent call last):
  File "/home/bhearsum/tmp/buildapi/buildapi/lib/mq.py", line 103, in wait
    queue=self.queue)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/messaging.py", line 233, in __init__
    self.declare()
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/messaging.py", line 271, in declare
    warn_if_exists=self.warn_if_exists)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/backends/pyamqplib.py", line 245, in queue_declare
    return self.channel.queue_declare(queue=queue,
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/backends/pyamqplib.py", line 187, in channel
    connection = self.connection.connection
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/connection.py", line 135, in connection
    self._connection = self._establish_connection()
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/connection.py", line 148, in _establish_connection
    return self.create_backend().establish_connection()
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/carrot-0.10.7-py2.7.egg/carrot/backends/pyamqplib.py", line 208, in establish_connection
    connect_timeout=conninfo.connect_timeout)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/amqplib-1.0.2-py2.7.egg/amqplib/client_0_8/connection.py", line 129, in __init__
    self.transport = create_transport(host, connect_timeout, ssl)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/amqplib-1.0.2-py2.7.egg/amqplib/client_0_8/transport.py", line 281, in create_transport
    return TCPTransport(host, connect_timeout)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/amqplib-1.0.2-py2.7.egg/amqplib/client_0_8/transport.py", line 85, in __init__
    raise socket.error, msg
error: [Errno 111] Connection refused
--------------------- >> end captured logging << ---------------------

======================================================================
ERROR: Failure: KeyError ('builds')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/bhearsum/.virtualenvs/buildapi/local/lib/python2.7/site-packages/nose-1.0.0-py2.7.egg/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/bhearsum/tmp/buildapi/buildapi/model/slaves.py", line 13, in <module>
    b = meta.status_db_meta.tables['builds']
KeyError: 'builds'

----------------------------------------------------------------------
Ran 48 tests in 23.396s
It looks like you don't have the tables in place.  Buildapi doesn't have any automatic handling of schemas.  You have to actually install them yourself.  The README describes this, as well as some of the detail about packages.

If you run the tests via 'python setup.py test', it pulls in mock.  I did just notice that the `tests_require` key in setup.py doesn't give a nose version, which is probably how you ended up with 1.2.0 installed.  If you add that to your review I can fix it before landing.

And no, it's not possible to install gviz_api via pip, but I don't have it installed either and the tests pass, so that shouldn't be a problem.
Comment on attachment 8356875 [details] [diff] [review]
testing-devel.patch

Review of attachment 8356875 [details] [diff] [review]:
-----------------------------------------------------------------

I can't make these tests fully run, but I'm going to trust that they pass on a properly configured system.
Attachment #8356875 - Flags: review?(catlee) → review+
landed, but with automatic updating on buildapi01 already disabled (so no immediate impact)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Component: General Automation → General
You need to log in before you can comment on or make changes to this bug.