telemetry-tempest-plugin: aodh tempest test fails when running with python3

Bug #1809802 reported by yatin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Aodh
New
Undecided
yatin

Bug Description

aodh tempest tests failed on python3 with below Error, Detected while testing python3 with Fedora in [1]:-

ft1.1: setUpClass (telemetry_tempest_plugin.aodh.api.test_alarming_api.TelemetryAlarmingAPITest)testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tempest/test.py", line 172, in setUpClass
    six.reraise(etype, value, trace)
  File "/usr/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/tempest/test.py", line 165, in setUpClass
    cls.resource_setup()
  File "/usr/lib/python3.6/site-packages/telemetry_tempest_plugin/aodh/api/test_alarming_api.py", line 32, in resource_setup
    gnocchi_aggregation_by_metrics_threshold_rule=cls.rule)
  File "/usr/lib/python3.6/site-packages/telemetry_tempest_plugin/aodh/api/base.py", line 49, in create_alarm
    type='gnocchi_aggregation_by_metrics_threshold', **kwargs)
  File "/usr/lib/python3.6/site-packages/telemetry_tempest_plugin/aodh/service/client.py", line 78, in create_alarm
    body = self.deserialize(body)
  File "/usr/lib/python3.6/site-packages/telemetry_tempest_plugin/aodh/service/client.py", line 32, in deserialize
    return json.loads(body.replace("\n", ""))
TypeError: a bytes-like object is required, not 'str'

The "body" in Traceback contains byte object, and replace do not work with it, need to fix it to work with both python2 and python3.

Simple reproducer:- python3 -c "a=b'abc'; a.replace('a','x')"

Fix: python3 -c "a=b'abc'; a.decode('utf-8').replace('a','x')"

[1] https://review.openstack.org/#/c/625613/

yatin (yatinkarel)
Changed in aodh:
assignee: nobody → yatin (yatinkarel)
Revision history for this message
yatin (yatinkarel) wrote :

Fix Proposed to branch: master
Review: https://review.openstack.org/#/c/627401/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/telemetry-tempest-plugin 0.2.0

This issue was fixed in the openstack/telemetry-tempest-plugin 0.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.