test_list_servers_negative failing one test

Bug #1072841 reported by Jay Pipes
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tempest
Fix Released
High
David Kranz

Bug Description

18:23:43 ======================================================================
18:23:43 FAIL: Return an error when a numeric value for status is specified
18:23:43 ----------------------------------------------------------------------
18:23:43 Traceback (most recent call last):
18:23:43 File "/opt/stack/tempest/tempest/tests/compute/servers/test_list_servers_negative.py", line 146, in test_list_servers_pass_numeric_status
18:23:43 {'status': 1})
18:23:43 AssertionError: BadRequest not raised
18:23:43 >> raise self.failureException, "%s not raised" % 'BadRequest'

Showing up reliably in full tempest run now...

Jay Pipes (jaypipes)
Changed in tempest:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Commit e142d21b47e8895a013c468936e69ba0e7e66041 to Nova caused this failure in tempest. The behavior of Nova to return an empty list to a filter is correct, so Tempest just needs to be updated to reflect this.

Revision history for this message
Jay Pipes (jaypipes) wrote :

OK, thx Brian. Much appreciated.

Changed in tempest:
assignee: nobody → Jay Pipes (jaypipes)
Revision history for this message
Jay Pipes (jaypipes) wrote :

OK, this is really weird...

Running against devstack, I'm getting errors after changing to expect a 200 OK with empty list returned:

======================================================================
ERROR: Return an empty list when a numeric value for status is specified
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jpipes/repos/tempest/tempest/tests/compute/servers/test_list_servers_negative.py", line 145, in test_list_servers_pass_numeric_status
    resp, body = self.client.list_servers(dict(status=non_existing_status))
  File "/home/jpipes/repos/tempest/tempest/services/compute/json/servers_client.py", line 131, in list_servers
    resp, body = self.get(url)
  File "/home/jpipes/repos/tempest/tempest/common/rest_client.py", line 166, in get
    return self.request('GET', url, headers)
  File "/home/jpipes/repos/tempest/tempest/common/rest_client.py", line 211, in request
    raise exceptions.BadRequest(resp_body)
BadRequest: Bad request
Details: Bad request
Details: {u'badRequest': {u'message': u'Invalid server status: 1', u'code': 400}}
-------------------- >> begin captured logging << --------------------
tempest.common.rest_client: ERROR: Request URL: http://127.0.0.1:8774/v2/e070e2b43ff94c32aa69a441c0a6e653/servers?status=1&
tempest.common.rest_client: ERROR: Request Body: None
tempest.common.rest_client: ERROR: Response Headers: {'date': 'Mon, 29 Oct 2012 21:24:05 GMT', 'status': '400', 'content-length': '68', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-aa2833c4-f9e5-47b9-a196-da5006689dfc'}
tempest.common.rest_client: ERROR: Response Body: {u'badRequest': {u'message': u'Invalid server status: 1', u'code': 400}}

jpipes@uberbox:~/repos/devstack$ ./tools/info.sh |grep nova
git|nova|master[b961bd4]
git|python-novaclient|master[247b530]
pip|https://github.com/openstack/nova.git|b961bd4c2916559bca856bc8b142d9df7494ef13
pip|https://github.com/openstack/python-novaclient.git|247b53022bced6d831e9ad10fb64fe520d00660b

Revision history for this message
David Kranz (david-kranz) wrote :

I just tried this with the current devstack and it worked. But if the intended behavior is to accept anything and return an empty list then perhaps this case should just be removed.

diff --git a/tempest/tests/compute/servers/test_list_servers_negative.py b/tempest/tests/compute/servers/test_list_servers_
index 1be7480..340b28c 100644
--- a/tempest/tests/compute/servers/test_list_servers_negative.py
+++ b/tempest/tests/compute/servers/test_list_servers_negative.py
@@ -142,8 +142,9 @@ class ListServersNegativeTest(BaseComputeTest):

     def test_list_servers_pass_numeric_status(self):
         """Return an error when a numeric value for status is specified"""
- self.assertRaises(exceptions.BadRequest, self.client.list_servers,
- {'status': 1})
+ resp, body = self.client.list_servers({'status': 1})
+ self.assertEqual('200', resp['status'])
+ self.assertEqual(0, len(body['servers']))

     def test_list_servers_by_limits(self):
         """List servers by specifying limits"""

Jay Pipes (jaypipes)
Changed in tempest:
assignee: Jay Pipes (jaypipes) → David Kranz (david-kranz)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tempest (master)

Fix proposed to branch: master
Review: https://review.openstack.org/15653

Changed in tempest:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tempest (master)

Reviewed: https://review.openstack.org/15653
Committed: http://github.com/openstack/tempest/commit/92d3f6308ccbfe130f722e3adc9c040b227d3f7c
Submitter: Jenkins
Branch: master

commit 92d3f6308ccbfe130f722e3adc9c040b227d3f7c
Author: David Kranz <email address hidden>
Date: Thu Nov 8 13:34:01 2012 -0500

    Remove unnecessary test. Fixes bug 1072841.

    Providing a bad status is no longer a failure so this case is not needed.

    Change-Id: Id0b2282bf23c3ccd50e967111e943f93fc4ea683

Changed in tempest:
status: In Progress → Fix Released
Sean Dague (sdague)
Changed in tempest:
milestone: none → havana-3
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.