Spurious failure: maasserver.tests.test_api.TestNodeGroupInterfacesAPI.test_new_creates_interface

Bug #1337246 reported by Raphaël Badin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Raphaël Badin

Bug Description

======================================================================
FAIL: maasserver.tests.test_api.TestNodeGroupInterfacesAPI.test_new_creates_interface
----------------------------------------------------------------------
_StringException: Traceback (most recent call last):
  File "/home/ubuntu/maas/src/maasserver/tests/test_api.py", line 538, in test_new_creates_interface
    self.assertEqual(httplib.OK, response.status_code, response.content)
  File "/home/ubuntu/maas/eggs/testtools-0.9.34-py2.7.egg/testtools/testcase.py", line 324, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/home/ubuntu/maas/eggs/testtools-0.9.34-py2.7.egg/testtools/testcase.py", line 414, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: 200 != 400: {"static_ip_range_low": ["Enter a valid IPv4 or IPv6 address."], "static_ip_range_high": ["Enter a valid IPv4 or IPv6 address."]}

-------------------- >> begin captured logging << --------------------
maasserver: DEBUG: ################################# Request dump ################################
<WSGIRequest
path:/api/1.0/nodegroups/7ea60a66-0228-11e4-b342-fa163ec2e102/interfaces/,
GET:<QueryDict: {}>,
POST:<QueryDict: {u'ip_range_high': [u'204.236.155.110'], u'ip_range_low': [u'204.236.155.109'], u'broadcast_ip': [u'204.236.155.111'], u'static_ip_range_low':
 [u'None'], u'ip': [u'204.236.155.110'], u'subnet_mask': [u'255.255.255.248'], u'management': [u'0'], u'router_ip': [u'204.236.155.109'], u'static_ip_range_hig
h': [u'None'], u'interface': [u'interface-3pEXo0'], u'op': [u'new']}>,
COOKIES:{},
META:{'Authorization': u'OAuth realm="", oauth_nonce="06830685", oauth_timestamp="1404333367", oauth_consumer_key="WXHPuk46ksJcXxtQeW", oauth_signature_method=
"PLAINTEXT", oauth_version="1.0", oauth_token="w4xczd3XJ9YcdkFeMt", oauth_signature="%26cvYvkeffr82fyXfd9rMMwxG9C2nQ92ja"',
 u'CONTENT_LENGTH': 950,
 u'CONTENT_TYPE': u'multipart/form-data; boundary=BoUnDaRyStRiNg',
 u'HTTP_AUTHORIZATION': u'OAuth realm="", oauth_nonce="06830685", oauth_timestamp="1404333367", oauth_consumer_key="WXHPuk46ksJcXxtQeW", oauth_signature_method
="PLAINTEXT", oauth_version="1.0", oauth_token="w4xczd3XJ9YcdkFeMt", oauth_signature="%26cvYvkeffr82fyXfd9rMMwxG9C2nQ92ja"',
 u'HTTP_COOKIE': u'',
 u'PATH_INFO': u'/api/1.0/nodegroups/7ea60a66-0228-11e4-b342-fa163ec2e102/interfaces/',
 u'QUERY_STRING': '',
 u'REMOTE_ADDR': '127.0.0.1',
 u'REQUEST_METHOD': 'POST',
 u'SCRIPT_NAME': u'',
 u'SERVER_NAME': 'testserver',
 u'SERVER_PORT': '80',
 u'SERVER_PROTOCOL': 'HTTP/1.1',
 u'wsgi.errors': <_io.BytesIO object at 0x2abdf49eae30>,
 u'wsgi.input': <django.test.client.FakePayload object at 0x2abdf447bb10>,
 u'wsgi.multiprocess': True,
 u'wsgi.multithread': False,
 u'wsgi.run_once': False,
 u'wsgi.url_scheme': 'http',
 u'wsgi.version': (1, 0)}>

maasserver: ERROR: ################################ Exception: {u'static_ip_range_low': [u'Enter a valid IPv4 or IPv6 address.'], u'static_ip_range_hig[0/3157]nter a valid IPv4 or IPv6 address.']} ################################
maasserver: ERROR: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/lib/python2.7/dist-packages/django/views/decorators/vary.py", line 19, in inner_func
    response = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 167, in __call__
    result = self.error_handler(e, request, meth, em_format)
  File "/usr/lib/python2.7/dist-packages/piston/resource.py", line 165, in __call__
    result = meth(request, *args, **kwargs)
  File "/home/ubuntu/maas/src/maasserver/api_support.py", line 189, in dispatch
    return function(self, request, *args, **kwargs)
  File "/home/ubuntu/maas/src/maasserver/api.py", line 2038, in new
    raise ValidationError(form.errors)
ValidationError: {u'static_ip_range_low': [u'Enter a valid IPv4 or IPv6 address.'], u'static_ip_range_high': [u'Enter a valid IPv4 or IPv6 address.']}

maasserver: DEBUG: ################################ Response dump ################################
{"static_ip_range_low": ["Enter a valid IPv4 or IPv6 address."], "static_ip_range_high": ["Enter a valid IPv4 or IPv6 address."]}
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------

How to reproduce:

run-one-until-failure ./bin/test.maas src/maasserver/tests/test_api.py:TestNodeGroupInterfacesAPI.test_new_creates_interface

Analysis of the problem:

In this test, from time to time, 'static_ip_range_high' and 'static_ip_range_low' are 'None' and thus fail the validation (they should be either the empty string or valid IP addresses).

Related branches

Raphaël Badin (rvb)
Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
milestone: none → 1.6.0
Raphaël Badin (rvb)
Changed in maas:
assignee: nobody → Raphaël Badin (rvb)
Changed in maas:
status: Fix Committed → Fix Released
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.