← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1437086] [NEW] [LBaaS V2] http_method and Url_path needs to be validated

 

Public bug reported:

The following are two test cases, one is to validate url_path, while the other is to validate http_method when try to create health monitor for LBaaS API V2 Testing , when unit test these 2 method, it throws exceptions, and I believe that we need to validate these two input parameters.
   
 @test.attr(type='negative')
    def test_create_health_monitor_invalid_url_path(self):
        """Test if a non_admin user can create a health monitor with invalid
        url_path
        """
        self.assertRaises(ex.BadRequest, self._create_healthmonitor,
                          type='HTTP', delay=3, max_retries=10, timeout=5,
                          pool_id=self.pool.get('id'), url_path='blah'
                          )

    @test.attr(type='negative')
    def test_create_health_monitor_invalid_http_method(self):
        """Test if a non_admin user can create a health monitor with invalid
        http_method
        """
        self.assertRaises(ex.BadRequest, self._create_healthmonitor,
                          type='HTTP', delay=3, max_retries=10, timeout=5,
                          pool_id=self.pool.get('id'), http_method='blah')


The following list one of the testing results:

/usr/bin/python2.7 /home/test/pycharm/pycharm-4.0.5/helpers/pycharm/utrunner.py /opt/stack/neutron-lbaas/neutron_lbaas/tests/tempest/v2/api/test_health_monitors.py::TestHealthMonitors::test_create_health_monitor_invalid_url_path true
Testing started at 5:03 PM ...

Process finished with exit code 0

Failure
_StringException: pythonlogging:'': {{{
2015-03-26 17:04:04,737 63704 INFO     [tempest_lib.common.rest_client] Request (TestHealthMonitors:test_create_health_monitor_invalid_url_path): 201 POST http://192.168.41.148:9696/v2.0/lbaas/healthmonitors 0.295s
2015-03-26 17:04:04,738 63704 DEBUG    [tempest_lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<omitted>'}
        Body: {"healthmonitor": {"pool_id": "b58697d4-394a-42ee-b286-f7c8f9948e51", "delay": 3, "max_retries": 10, "timeout": 5, "url_path": "blah", "type": "HTTP"}}
    Response - Headers: {'status': '201', 'content-length': '325', 'connection': 'close', 'date': 'Fri, 27 Mar 2015 00:04:04 GMT', 'content-type': 'application/json; charset=UTF-8', 'x-openstack-request-id': 'req-ba46d1e7-5746-48d2-a020-df728dd8a2c3'}
        Body: {"healthmonitor": {"admin_state_up": true, "tenant_id": "54a5008e089f4b92978ead92da67ed91", "delay": 3, "expected_codes": "200", "max_retries": 10, "http_method": "GET", "timeout": 5, "pools": [{"id": "b58697d4-394a-42ee-b286-f7c8f9948e51"}], "url_path": "blah", "type": "HTTP", "id": "f6d0cfdc-359b-4afb-872e-8914fcd49bf4"}}
2015-03-26 17:04:04,781 63704 INFO     [test_health_monitors:TestHealthMonitors] Finished: test_create_health_monitor_invalid_url_path
}}}

Traceback (most recent call last):
  File "/opt/stack/neutron-lbaas/neutron_lbaas/tests/tempest/v2/api/test_health_monitors.py", line 309, in test_create_health_monitor_invalid_url_path
    pool_id=self.pool.get('id'), url_path='blah'
  File "/usr/local/lib/python2.7/dist-packages/testtools/testcase.py", line 422, in assertRaises
    self.assertThat(our_callable, matcher)
  File "/usr/local/lib/python2.7/dist-packages/testtools/testcase.py", line 435, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: <bound method TestHealthMonitors._create_healthmonitor of <test_health_monitors.TestHealthMonitors.test_create_health_monitor_invalid_url_path[negative] id=0x7f4f55cd1710>> returned {u'admin_state_up': True, u'tenant_id': u'54a5008e089f4b92978ead92da67ed91', u'delay': 3, u'expected_codes': u'200', u'max_retries': 10, u'http_method': u'GET', u'timeout': 5, u'pools': [{u'id': u'b58697d4-394a-42ee-b286-f7c8f9948e51'}], u'url_path': u'blah', u'type': u'HTTP', u'id': u'f6d0cfdc-359b-4afb-872e-8914fcd49bf4'}

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1437086

Title:
  [LBaaS V2] http_method and Url_path needs to be validated

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  The following are two test cases, one is to validate url_path, while the other is to validate http_method when try to create health monitor for LBaaS API V2 Testing , when unit test these 2 method, it throws exceptions, and I believe that we need to validate these two input parameters.
     
   @test.attr(type='negative')
      def test_create_health_monitor_invalid_url_path(self):
          """Test if a non_admin user can create a health monitor with invalid
          url_path
          """
          self.assertRaises(ex.BadRequest, self._create_healthmonitor,
                            type='HTTP', delay=3, max_retries=10, timeout=5,
                            pool_id=self.pool.get('id'), url_path='blah'
                            )

      @test.attr(type='negative')
      def test_create_health_monitor_invalid_http_method(self):
          """Test if a non_admin user can create a health monitor with invalid
          http_method
          """
          self.assertRaises(ex.BadRequest, self._create_healthmonitor,
                            type='HTTP', delay=3, max_retries=10, timeout=5,
                            pool_id=self.pool.get('id'), http_method='blah')


  The following list one of the testing results:

  /usr/bin/python2.7 /home/test/pycharm/pycharm-4.0.5/helpers/pycharm/utrunner.py /opt/stack/neutron-lbaas/neutron_lbaas/tests/tempest/v2/api/test_health_monitors.py::TestHealthMonitors::test_create_health_monitor_invalid_url_path true
  Testing started at 5:03 PM ...

  Process finished with exit code 0

  Failure
  _StringException: pythonlogging:'': {{{
  2015-03-26 17:04:04,737 63704 INFO     [tempest_lib.common.rest_client] Request (TestHealthMonitors:test_create_health_monitor_invalid_url_path): 201 POST http://192.168.41.148:9696/v2.0/lbaas/healthmonitors 0.295s
  2015-03-26 17:04:04,738 63704 DEBUG    [tempest_lib.common.rest_client] Request - Headers: {'Content-Type': 'application/json', 'Accept': 'application/json', 'X-Auth-Token': '<omitted>'}
          Body: {"healthmonitor": {"pool_id": "b58697d4-394a-42ee-b286-f7c8f9948e51", "delay": 3, "max_retries": 10, "timeout": 5, "url_path": "blah", "type": "HTTP"}}
      Response - Headers: {'status': '201', 'content-length': '325', 'connection': 'close', 'date': 'Fri, 27 Mar 2015 00:04:04 GMT', 'content-type': 'application/json; charset=UTF-8', 'x-openstack-request-id': 'req-ba46d1e7-5746-48d2-a020-df728dd8a2c3'}
          Body: {"healthmonitor": {"admin_state_up": true, "tenant_id": "54a5008e089f4b92978ead92da67ed91", "delay": 3, "expected_codes": "200", "max_retries": 10, "http_method": "GET", "timeout": 5, "pools": [{"id": "b58697d4-394a-42ee-b286-f7c8f9948e51"}], "url_path": "blah", "type": "HTTP", "id": "f6d0cfdc-359b-4afb-872e-8914fcd49bf4"}}
  2015-03-26 17:04:04,781 63704 INFO     [test_health_monitors:TestHealthMonitors] Finished: test_create_health_monitor_invalid_url_path
  }}}

  Traceback (most recent call last):
    File "/opt/stack/neutron-lbaas/neutron_lbaas/tests/tempest/v2/api/test_health_monitors.py", line 309, in test_create_health_monitor_invalid_url_path
      pool_id=self.pool.get('id'), url_path='blah'
    File "/usr/local/lib/python2.7/dist-packages/testtools/testcase.py", line 422, in assertRaises
      self.assertThat(our_callable, matcher)
    File "/usr/local/lib/python2.7/dist-packages/testtools/testcase.py", line 435, in assertThat
      raise mismatch_error
  testtools.matchers._impl.MismatchError: <bound method TestHealthMonitors._create_healthmonitor of <test_health_monitors.TestHealthMonitors.test_create_health_monitor_invalid_url_path[negative] id=0x7f4f55cd1710>> returned {u'admin_state_up': True, u'tenant_id': u'54a5008e089f4b92978ead92da67ed91', u'delay': 3, u'expected_codes': u'200', u'max_retries': 10, u'http_method': u'GET', u'timeout': 5, u'pools': [{u'id': u'b58697d4-394a-42ee-b286-f7c8f9948e51'}], u'url_path': u'blah', u'type': u'HTTP', u'id': u'f6d0cfdc-359b-4afb-872e-8914fcd49bf4'}

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1437086/+subscriptions


Follow ups

References