passenv is required so that database configuration environment
variables are properly available to the tests.
Change-Id: I44050f7bbfdd27b4e4e729d23f3f8e29899d14ca
Closes-Bug: #1494339
Run the functional tests against python3.4 with 'tox
-epy34-functional'.
hbase is not supported in py34 so there are fewer tests run when
compared with the py27 functional tests.
Change-Id: I68ee3e09a446d449e947c87985c10944fbea93ba
This change makes it so that if you call `tox` or `tox -r` you will
get a useful result as a developer running tests:
* py27 and py34 unit tests
* a single functional test run (using mongodb)
* pep8
This is slightly different from what was there before which was
as above but _two_ functional test runs, with mysql and postgresql.
The goal here is to make it dead simple for someone to (as quickly
as possible) make sure that there code is okay before committing.
Change-Id: I27dcf5265dea18be541b8b2857b0a135ff22f499
This change:
* we can downscale the stack.
* use two vm instead of three to reduce the test duration
Related-bug: #1479429
Change-Id: Ifea9869cd98654d168eb8e95c6e84d3a80bc32cc
In this CR functional tox jobs with "oslo_debug_helper" have
been added. Currently we can run oslo_debug_helper only for unit
tests directory.
Change-Id: Ib6b79b8af4ca9718720a789b3e0ab6b9600a4671
This change uses 'gabbi-run -x' instead of 'testr'
to stop at the first errors.
We loose the testr report, but currentlty we have
only one scenario, this is not a big deal.
Change-Id: I9ca50592e959fec4669bef3d8e645268d2d3c3d5
Currently we run tests which uses real backend or real daemons with
other unit tests.
This CR is initial for sequence of functional tests implementation.
It contains only moving files and modules to right directories and
fixing tox.ini. This approach allows to avoid constantly rebase conflicts,
because git handles file removing correct.
Next step - separate classes and functions from moved files to right
test types.
Depends-On: Ifdb0de150b2c738117308b2aae6c0c197e162821
Change-Id: I16b84ed83ac075658626f3ec6a35a24e228b61e7
Partialy-Implement: blueprint ceilometer-functional-tests
* HTTP body type is bytes
* query.py: Exception.message attribute was removed on Python 3
* mock calls cannot be sorted (mock calls are not comparable), use
the assert_has_calls() with any_order=True instead.
* Port decode_unicode() on Python 3: decode bytes from UTF-8 on Python 3
instead of encoding Unicode to UTF-8
* MeterDefinitionException: add message attribute
* tox.ini: add more tests to Python 3.4
Change-Id: Iadd1c83b250d2f941262cc6e7dba4c27cb56893d
This change adds an integration test.
It need a devstack with heat/aodh/ceilometer/gnocchi setuped.
The test does the following:
* check no servers and alarms are present
* create a heat autoscaling stack with aodh alarms for gnocchi
* check that the stack creation succeed
* check the stack automatically grow according the alarm configuration
* check the gnocchi resource have been created
* delete the stack
* check everything have been deleted
This test use gabbi to talk with all API.
Change-Id: I897ef4aa359fa7b65c0f18b1999e403eb89045a7
there's a notifier in our code. it doesn't seem to be connected to
anything and is not accessible via setup.cfg. this appears to be
residual workaround from pre-oslo.messaging days
Change-Id: I50c8e97219da387362aef9d1ef4c53aea0c27142
* query.py: the message attribute of Exception was removed in Python 3,
replace e.message with e to format the new error message
* Fix test_complex_query_scenarios: convert
sample_item["metadata"]["util"] to float; "0.5" >= 0.5 is True in
Python 2, but it raises a TypeError on Python 3.
* tox.ini: add the following API v2 tests to Python 3.4:
- test_complex_query_scenarios.TestQueryMetersController.test_query_with_volume_field_name_orderby
Change-Id: I112e5564a65db005cf66ce967a8ac3e52fa95267
* Use repr() at runtime instead of using the hardcoded result:
repr(u'abc') returns 'abc' on Python 3, not u'abc'.
* Add the following api.v2 test to tox.ini for Python 3.4
- test_alarm_scenarios.TestAlarms.test_get_alarm_history_constrained_by_alarm_id_failed
Change-Id: Ied224b194a73e14c2c04ff3d9837964420ce766c
* CombinationEvaluator: convert states (built using zip) to a list
because states is consumed more than once. On Python 3, zip() returns
an iterator which can only be consumed once.
* Replace dict.keys()[0] with list(dict.keys())[0]. On Python 3, keys()
returns an iterator which is not indexable.
* test_event_scenarios: replace filter() with a list-comprehension, the
test expects a list whereas filter() returns on iterator on Python 3.
* mongo/utils.py: replace obj.keys()[0] with list(obj.keys())[0],
and replace obj.values()[0] with list(obj.values())[0]
* Add the following API v2 tests to tox.ini in Python 3.4:
- test_event_scenarios.TestEventAPI.test_get_events_filter_datetime_trait
Change-Id: I28bcb65940edbc226c8dbb272f4e3c040ebc37a1
* HTTP body type is bytes: fix tests to use bytes strings.
* test_list_resources_scenarios: on Python 3, base64.encodestring() returns
bytes whereas the test expects bytes; decode the result from ASCII.
* tox.ini: add the following API v2 tests to Python 3.4:
- test_alarm_scenarios.TestAlarms.test_alarms_query_with_timestamp
- test_complex_query_scenarios.TestQueryMetersController.test_query_with_isotime
- test_list_resources_scenarios.TestListResources.test_with_invalid_resource_id
Change-Id: I8258c2d17fbc1236f4bcda40bff93a93bddf13e2
* Call msgpack.loads() with an encoding to get unicode strings, not
byte strings
* Sort counters using their name because a counter is a dictionary
and dictionaries are not comparable in Python 3.
* Add test_udp to tox.ini for Python 3.4.
Change-Id: Ifa20eecbc1c293da667f58843b7a6c2d7f32152c
* Fix keystoneclient mock on Python 3: service_catalog.url_for() must
return a string because urllib.parse.urljoin() is now more strict on
Python 3
* tox -e py34: add objectstore.test_rgw
Change-Id: I0a4a33a26b7984854c8561866a6f49e2b4d7ff6d
binascii.hexlify() returns a byte string whereas the code expects a
native string, so Unicode on Python 3. On Python 3, decode the string
from ASCII to get Unicode.
Enable ipmi tests in tox.ini on Python 3.4.
Change-Id: I154723ad42efb61a06b71600975374441920a852
* Fix integer division: status_code/100 => status_code//100
* HTTP body type is bytes. Decode the HTTP body from UTF-8 to use it.
Encode XML and JSON to UTF-8 to produce the HTTP body (for error
messages).
* Factorize XML/JSON code a little bit more (ex: add the new
content_type variable)
* Fix test_app on Python 3: decode HTTP from UTF-8 to load JSON
* tox.ini: add api.v2.test_app to Python 3.4
Change-Id: I4f916cba36306f776b01df915c55e314ade6b6ba
* Fix test_get_connection: max_bytes and backup_count parameters of the
logging module must be int, not None.
* Fix test_query on Python 3: ast.literal_eval("1+1") now returns 2 on
Python 3, whereas it raises a ValueError on Python 2. Use a string
invalid in Python 2 and Python 3 based on the original bug report
#1221736
* test_swift: fix url_for() mock, it now returns a string for the
endpoint
* storage.test_get_connection: skip test_three_urls_no_default()
if the happybase module is missing (it's not compatible with Python 3
yet)
Enable more tests on Python 3.4:
* ceilometer.tests.api.v2.test_query
* ceilometer.tests.dispatcher.test_db
* ceilometer.tests.dispatcher.test_file
* ceilometer.tests.dispatcher.test_http
* ceilometer.tests.objectstore.test_swift
* ceilometer.tests.storage.test_get_connection
Change-Id: I1d9bdd73bd21ec5dc8ee9823352f6dfe818b8d6b
This CR allows running "functional" tox job for different backends.
Short description about expected workflow:
1. Gate job run ceilometer/ceilometer/tests/functional/hooks/post_test_hook.py
with <backend> parameter.
2. This script run "tox -efunctional" command with defined variable
CEILOMETER_TEST_BACKEND
3. After in "run-functional-tests.sh" setup script for the backend
and testr are runned.
In this CR running testr with pretty_tox.sh script added because
it allows to use subunit-trace output which developed in tempest-lib
and improve useful of testr output.
Partially implements: blueprint ceilometer-functional-tests
Change-Id: Idb66aca0b46779516db2baec856df8223dbe5c13
oslo.log has graduated from oslo-incubator, and openstack.common.log
has been removed from oslo-incubator, so let's use the new one.
NOTE1:openstack.common.log registers its options at import time, but
oslo.log needs to call register_options() explicitly.
NOTE2: split unit test case in tests/objectstore/test_swift_middleware.py
to avoid duplicate cli option register exception, see NOTE1.
Change-Id: Ida30808dbe0c584919755c207ca4ee4b91963a17
* Replace contextlib.nested() with contextlib.ExitStack
* Add contextlib2 dependency for Python 2.6 and 2.7 to get ExitStack
* TestLibvirtInspection: set libvirtError because it must be a subclass
of Exception on Python 3
Enable ceilometer.tests.compute.virt.libvirt.test_inspector on Python 3.
Change-Id: I82f4b911c1b3ede90805150630c222b1dd5f3474
Convert the result of keys(), values() and items() dict method to list
when a list is expected. On Python 3, these methods now return an
iterator, not a list.
Instead of getting the key with .keys()[0] and then the value with
.values()[0], get both at the same time using .items()[0]. It ensures
that the key is consistent with the value, but it is also more
efficient.
Enable ceilometer.tests.storage.test_impl_sqlalchemy on Python 3.4.
Change-Id: I4bcd3dfbca3e26238cdcdf19801244497dac2729
* Trait.convert_value() now explicitly decodes byte strings from UTF-8:
it fixes a BytesWarning error when Python 3 is run using -bb command
line option
* Replace types.NoneType with type(None)
* fileutils.write_to_tempfile() expects content as bytes: encode the
content on Python 3
* subprocess.Popen.communicate() returns stdout and stderr as bytes:
check for pattern using byte strings
* Fix verify_signature() on Python 3: encode new signature to ASCII
* Replace "with contextlib.nested(...):" with two nested with,
contextlib.nested() was removed in Python 3
* Fix import in test_messaging
* tox -e py34 now runs much more tests
Change-Id: If2a16c3b8ca64ca86d8172b36ecbf6298044ec87