Skip to content

Instantly share code, notes, and snippets.

@terriyu
Last active December 19, 2015 14:59
Show Gist options
  • Select an option

  • Save terriyu/5973022 to your computer and use it in GitHub Desktop.

Select an option

Save terriyu/5973022 to your computer and use it in GitHub Desktop.
I cherrypicked the patch here: https://review.openstack.org/#/c/33290/ , so that I could use a real MongoDB instance with my tests. Unfortunately, if I use the same port more than once ("29000" in the file below), then I get a connection error. My temporary hack is to edit the file run-tests.sh to use a different port for each tox run.
GLOB sdist-make: /opt/stack/ceilometer/setup.py
py27 inst-nodeps: /opt/stack/ceilometer/.tox/dist/ceilometer-2013.2.a161.g6ef0a97.zip
py27 runtests: commands[0]
WARNING:test command found but not installed in testenv
cmd: /bin/bash
env: /opt/stack/ceilometer/.tox/py27
Maybe forgot to specify a dependency?
+ set -e
+ bash tools/init_testr_if_needed.sh
+ python setup.py testr --slowest '--testr-args=--concurrency=1 --here=nova_tests tests.storage.test_impl_mongodb.RawSampleTest.test_get_samples_in_default_order'
running testr
running=${PYTHON:-python} -m subunit.run discover -t ./nova_tests ./nova_tests --list
PASSED (id=86)
Slowest Tests
Test id Runtime (s)
------------------------------------------------------------------------------- -----------
tests.storage.test_impl_mongodb.RawSampleTest.test_get_samples_in_default_order 315.662
process-returncode 0.000
++ mktemp -d
+ MONGO_DATA=/tmp/tmp.HzfTleYMtS
+ trap 'rm -rf /tmp/tmp.HzfTleYMtS' EXIT
+ MONGO_PID=4485
+ trap 'kill -9 4485 || true' EXIT
+ export CEILOMETER_TEST_MONGODB_URL=mongodb://localhost:29000/ceilometer
+ CEILOMETER_TEST_MONGODB_URL=mongodb://localhost:29000/ceilometer
+ python setup.py testr --slowest '--testr-args=--concurrency=1 tests.storage.test_impl_mongodb.RawSampleTest.test_get_samples_in_default_order'
+ mongod --maxConns 32 --smallfiles --quiet --noauth --port 29000 --dbpath /tmp/tmp.HzfTleYMtS --bind_ip localhost
Thu Jul 11 06:34:48 [initandlisten] MongoDB starting : pid=4485 port=29000 dbpath=/tmp/tmp.HzfTleYMtS 64-bit host=precise64
Thu Jul 11 06:34:48 [initandlisten] db version v2.0.4, pdfile version 4.5
Thu Jul 11 06:34:48 [initandlisten] git version: nogitversion
Thu Jul 11 06:34:48 [initandlisten] build info: Linux lamiak 2.6.42-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64 BOOST_LIB_VERSION=1_46_1
Thu Jul 11 06:34:48 [initandlisten] options: { bind_ip: "localhost", dbpath: "/tmp/tmp.HzfTleYMtS", maxConns: 32, noauth: true, port: 29000, quiet: true, smallfiles: true }
Thu Jul 11 06:34:48 [initandlisten] journal dir=/tmp/tmp.HzfTleYMtS/journal
Thu Jul 11 06:34:48 [initandlisten] recover : no journal files present, no recovery needed
running testr
Thu Jul 11 06:34:49 [initandlisten] preallocateIsFaster=true 15.86
Thu Jul 11 06:34:49 [initandlisten] preallocateIsFaster=true 15.46
Thu Jul 11 06:34:51 [initandlisten] preallocateIsFaster=true 16.2
Thu Jul 11 06:34:51 [initandlisten] preallocateIsFaster check took 3.594 secs
Thu Jul 11 06:34:51 [initandlisten] preallocating a journal file /tmp/tmp.HzfTleYMtS/journal/prealloc.0
Thu Jul 11 06:34:52 [initandlisten] preallocating a journal file /tmp/tmp.HzfTleYMtS/journal/prealloc.1
Thu Jul 11 06:34:52 [initandlisten] preallocating a journal file /tmp/tmp.HzfTleYMtS/journal/prealloc.2
Thu Jul 11 06:34:53 [initandlisten] waiting for connections on port 29000
Thu Jul 11 06:34:53 [websvr] admin web console waiting for connections on port 30000
running=${PYTHON:-python} -m subunit.run discover -t ./ ./tests --list
running=${PYTHON:-python} -m subunit.run discover -t ./ ./tests --load-list /tmp/tmpyrq9TQ
======================================================================
FAIL: tests.storage.test_impl_mongodb.RawSampleTest.test_get_samples_in_default_order
tags: worker-0
----------------------------------------------------------------------
pythonlogging:'': {{{connecting to MongoDB on localhost:29000}}}
Traceback (most recent call last):
File "/opt/stack/ceilometer/tests/storage/base.py", line 40, in setUp
super(DBTestBase, self).setUp()
File "/opt/stack/ceilometer/ceilometer/tests/db.py", line 34, in setUp
self.conn = storage.get_connection(cfg.CONF)
File "/opt/stack/ceilometer/ceilometer/storage/__init__.py", line 75, in get_connection
db = engine.get_connection(conf)
File "/opt/stack/ceilometer/ceilometer/storage/impl_mongodb.py", line 92, in get_connection
return Connection(conf)
File "/opt/stack/ceilometer/ceilometer/storage/impl_mongodb.py", line 248, in __init__
safe=True)
File "/opt/stack/ceilometer/.tox/py27/local/lib/python2.7/site-packages/pymongo/connection.py", line 220, in __init__
max_pool_size, document_class, tz_aware, _connect, **kwargs)
File "/opt/stack/ceilometer/.tox/py27/local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 337, in __init__
raise ConnectionFailure(str(e))
ConnectionFailure: could not connect to localhost:29000: [Errno 111] Connection refused
======================================================================
FAIL: process-returncode
tags: worker-0
----------------------------------------------------------------------
Binary content:
traceback (test/plain; charset="utf8")
Ran 2 tests in 0.211s (-315.855s)
FAILED (id=91, failures=2)
error: testr failed (1)
+ kill -9 4485
ERROR: InvocationError: '/bin/bash -x run-tests.sh tests.storage.test_impl_mongodb.RawSampleTest.test_get_samples_in_default_order'
___________________________________ summary ____________________________________
ERROR: py27: commands failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment