Project

General

Profile

Bug #23593

RESTControllerTest.test_detail_route and RESTControllerTest.test_fill fail

Added by Kefu Chai almost 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Tests
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

9: INFO:dashboard:Initializing controller: FooResource -> /api/foo
9: DEBUG:dashboard:Mapping [/foo] to FooResource:_collection restricted to ['DELETE', 'GET', 'POST']
9: DEBUG:dashboard:Mapping [/foo/:data/:key] to FooResource:_element restricted to ['PUT', 'DELETE', 'GET', 'PATCH']
9: INFO:dashboard:Initializing controller: FooResourceDetail -> /api/foo/:key/:method
9: DEBUG:dashboard:Mapping [/foo/:key/:method] to FooResourceDetail:_collection restricted to ['GET']
9: INFO:dashboard:Initializing controller: FooArgs -> /api/fooargs
9: DEBUG:dashboard:Mapping [/fooargs/:code] to FooArgs:_element restricted to ['PUT', 'PATCH']
9: INFO:cherrypy.error:[08/Apr/2018:05:50:02] ENGINE Bus STARTING
9: INFO:cherrypy.error:[08/Apr/2018:05:50:02] ENGINE Serving on http://127.0.0.1:54583
...
9: INFO:cherrypy.access.281473553397968:127.0.0.1 - - [08/Apr/2018:05:50:03] "PUT /foo/0 HTTP/1.1" 404 915 "" "" 
9:
9:     ERROR: Status 404 Not Found does not match 200 OK
9: FINFO:cherrypy.access.281473553397968:127.0.0.1 - - [08/Apr/2018:05:50:03] "PUT /foo HTTP/1.1" 404 911 "" "" 
...
9: _____________________ RESTControllerTest.test_detail_route _____________________
9:
9: self = <dashboard.tests.test_tools.RESTControllerTest testMethod=test_detail_route>
9:
9:     def test_detail_route(self):
9:         self._get('/foo/default')
9: >       self.assertJsonBody({'detail': ['default', []]})
9:
9: tests/test_tools.py:113:
9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
9: tests/helper.py:67: in assertJsonBody
9:     self._handlewebError(msg)
9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
9:
9: self = <dashboard.tests.test_tools.RESTControllerTest testMethod=test_detail_route>
9: msg = 'expected body:\n{\'detail\': [\'default\', []]}\n\nactual body:\n{u\'status\': u\'404 Not Found\', u\'version\': u\'1...or.py", line 416, in __call__\\n    raise self\\nNotFound: (404, "The path \\\'/foo/default\\\' was not found.")\\n\'}'
9:
9:     def _handlewebError(self, msg):
9:         print('')
9:         print('    ERROR: %s' % msg)
9:
9:         if not self.interactive:
9: >           raise self.failureException(msg)
9: E           AssertionError: expected body:
9: E           {'detail': ['default', []]}
9: E
9: E           actual body:
9: E           {u'status': u'404 Not Found', u'version': u'13.1.0', u'detail': u"The path '/foo/default' was not found.", u'traceback': u'Traceback (most recent call last):\n  File "/home/kchai/ceph/src/pybind/mgr/dashboard/.tox/py27/local/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 631, in respond\n    self._do_respond(path_info)\n  File "/home/kchai/ceph/src/pybind/mgr/dashboard/.tox/py27/local/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 690, in _do_respond\n    response.body = self.handler()\n  File "/home/kchai/ceph/src/pybind/mgr/dashboard/.tox/py27/local/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 221, in __call__\n    self.body = self.oldhandler(*args, **kwargs)\n  File "/home/kchai/ceph/src/pybind/mgr/dashboard/.tox/py27/local/lib/python2.7/site-packages/cherrypy/_cperror.py", line 416, in __call__\n    raise self\nNotFound: (404, "The path \'/foo/default\' was not found.")\n'}
9:
9: .tox/py27/local/lib/python2.7/site-packages/cheroot/test/webtest.py:325: AssertionError
9: ------------------------------ Captured log call -------------------------------
9: _cplogging.py              310 INFO     127.0.0.1 - - [08/Apr/2018:05:50:03] "GET /foo/default HTTP/1.1" 404 927 "" "" 
9: _________________________ RESTControllerTest.test_fill _________________________
9:
9: self = <dashboard.tests.test_tools.RESTControllerTest testMethod=test_fill>
9:
9:     def test_fill(self):
9:         sess_mock = RamSession()
9:         with patch('cherrypy.session', sess_mock, create=True):
9:             data = {'a': 'b'}
9:             for _ in range(5):
9:                 self._post("/foo", data)
9:                 self.assertJsonBody(data)
9:                 self.assertStatus(201)
9:                 self.assertHeader('Content-Type', 'application/json')
9:
9:             self._get("/foo")
9:             self.assertStatus('200 OK')
9:             self.assertHeader('Content-Type', 'application/json')
9:             self.assertJsonBody([data] * 5)
9:
9:             self._put('/foo/0', {'newdata': 'newdata'})
9: >           self.assertStatus('200 OK')
9:
9: tests/test_tools.py:88:
9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
9: .tox/py27/local/lib/python2.7/site-packages/cheroot/test/webtest.py:392: in assertStatus
9:     self._handlewebError(msg)
9: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
9:
9: self = <dashboard.tests.test_tools.RESTControllerTest testMethod=test_fill>
9: msg = 'Status 404 Not Found does not match 200 OK'
9:
9:     def _handlewebError(self, msg):
9:         print('')
9:         print('    ERROR: %s' % msg)
9:
9:         if not self.interactive:
9: >           raise self.failureException(msg)
9: E           AssertionError: Status 404 Not Found does not match 200 OK
9:
9: .tox/py27/local/lib/python2.7/site-packages/cheroot/test/webtest.py:325: AssertionError

i printed logging messages in FooResource.get() and FooResource.set(), and disabled the output capture in src/pybind/mgr/dashboard/tox.ini by passing "-s" to py.test, but they were not printed.

so i think these two methods where not printed.

this failure is reproducible once out of 2 times.

History

#2 Updated by Kefu Chai almost 6 years ago

  • Status changed from New to Fix Under Review

#3 Updated by Kefu Chai almost 6 years ago

  • Status changed from Fix Under Review to Resolved

Also available in: Atom PDF