Bug #36708
closedmgr/dashboard: backend api tests: tasks.mgr.dashboard.test_osd.OsdTest failures
0%
Description
Currently the dashboard backend api tests fail (when running the QA tests in sepia lab as well as when executing the run-backend-api-tests.sh locally) with:
2018-11-06 08:11:08,969.969 INFO:__main__:FAIL: test_create_lost_destroy_remove (tasks.mgr.dashboard.test_osd.OsdTest)
2018-11-06 08:11:08,969.969 INFO:__main__:----------------------------------------------------------------------
2018-11-06 08:11:08,969.969 INFO:__main__:Traceback (most recent call last):
2018-11-06 08:11:08,969.969 INFO:__main__: File "/ceph/qa/tasks/mgr/dashboard/test_osd.py", line 92, in test_create_lost_destroy_remove
2018-11-06 08:11:08,969.969 INFO:__main__: self.assertStatus(200)
2018-11-06 08:11:08,969.969 INFO:__main__: File "/ceph/qa/tasks/mgr/dashboard/helper.py", line 342, in assertStatus
2018-11-06 08:11:08,969.969 INFO:__main__: self.assertEqual(self._resp.status_code, status)
2018-11-06 08:11:08,970.970 INFO:__main__:AssertionError: 400 != 200
2018-11-06 08:11:08,970.970 INFO:__main__:
2018-11-06 08:11:08,970.970 INFO:__main__:----------------------------------------------------------------------
2018-11-06 08:11:08,970.970 INFO:__main__:Ran 37 tests in 453.681s
2018-11-06 08:11:08,970.970 INFO:__main__:
2018-11-06 08:11:08,971.971 INFO:__main__:FAILED (failures=1, skipped=1)
2018-11-06 08:11:08,971.971 INFO:__main__:
2018-11-06 08:11:08,971.971 INFO:__main__:======================================================================
2018-11-06 08:11:08,971.971 INFO:__main__:FAIL: test_create_lost_destroy_remove (tasks.mgr.dashboard.test_osd.OsdTest)
2018-11-06 08:11:08,971.971 INFO:__main__:----------------------------------------------------------------------
2018-11-06 08:11:08,971.971 INFO:__main__:Traceback (most recent call last):
2018-11-06 08:11:08,972.972 INFO:__main__: File "/ceph/qa/tasks/mgr/dashboard/test_osd.py", line 92, in test_create_lost_destroy_remove
2018-11-06 08:11:08,972.972 INFO:__main__: self.assertStatus(200)
2018-11-06 08:11:08,972.972 INFO:__main__: File "/ceph/qa/tasks/mgr/dashboard/helper.py", line 342, in assertStatus
2018-11-06 08:11:08,972.972 INFO:__main__: self.assertEqual(self._resp.status_code, status)
2018-11-06 08:11:08,972.972 INFO:__main__:AssertionError: 400 != 200
Files
Updated by Patrick Seidensal over 5 years ago
- Status changed from New to In Progress
- Assignee set to Patrick Seidensal
Updated by Patrick Seidensal over 5 years ago
- Assignee changed from Patrick Seidensal to Volker Theile
- Regression changed from No to Yes
Reproducible by making a POST request to `api/osd` with a JSON body containing `uuid` and `svc_id`. Both parameters aren't passed to the `create` method anymore. Regression introduced by https://github.com/ceph/ceph/pull/24475.
Updated by Patrick Seidensal over 5 years ago
- Status changed from In Progress to 12
Updated by Volker Theile over 5 years ago
- Subject changed from dashboard backend api tests: tasks.mgr.dashboard.test_osd.OsdTest failures to mgr/dashboard: backend api tests: tasks.mgr.dashboard.test_osd.OsdTest failures
Updated by Volker Theile over 5 years ago
- Status changed from 12 to Fix Under Review
Updated by Volker Theile over 5 years ago
Had to do some research what exactly is the problem: Our unit test framework or a Cherrypy tool plugin. The API Audit PR (#24475) introduces the usage of the CherryPy json_in plugin. It is responsible to decode the JSON body data. It seems our unit testing framework is submitting the 'application/json' header either nor JSON data is in the body. I don't know if this is correct, so the problem might be on the unit testing framework or the CherryPy plugin is too lax in validating the body before it tries to decode non-existing JSON data.
See https://github.com/cherrypy/cherrypy/blob/master/cherrypy/lib/jsontools.py#L13 for the point of problem.
If it is incorrect to submit the header then our old code simply ignores and catches an error of our unit test and CherryPy is doing the right job.
It comes out that our unit test framework did it wrong:
https://github.com/ceph/ceph/blob/2f5e7c33925c51c56b074453c50c4286375333eb/qa/tasks/mgr/dashboard/helper.py#L167
The application type header is normally set by the requests library if there is valid JSON data that is submitted in the request body:
https://github.com/requests/requests/blob/master/requests/models.py#L462
Updated by Volker Theile over 5 years ago
- File id_param_no_int.png id_param_no_int.png added
Updated by Volker Theile over 5 years ago
The https://github.com/ceph/ceph/pull/24947 PR also fixes a problem that comes out while debugging. The svc_id parameter in the create() method of the OSD controller is not converted into an integer if it was submitted as a string (e.g. when application type is 'x-www-form-urlencoded').
Updated by Lenz Grimmer over 5 years ago
- Status changed from Fix Under Review to Resolved
Updated by Ernesto Puerta about 3 years ago
- Project changed from mgr to Dashboard
- Category changed from 151 to Testing & QA