keystone.tests.test_wsgi.ServerTest.test_keepalive_and_keepidle_set MismatchError: 1 != 2

Bug #1296768 reported by Dolph Mathews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Low
Dolph Mathews

Bug Description

The following test consistently fails in OS X:

======================================================================
FAIL: keystone.tests.test_wsgi.ServerTest.test_keepalive_and_keepidle_set
----------------------------------------------------------------------
_StringException: pythonlogging:'': {{{
Adding cache-proxy 'keystone.tests.test_cache.CacheIsolatingProxy' to backend.
Starting /Users/dolph/Environments/os/bin/nosetests on 127.0.0.1:1234
}}}

Traceback (most recent call last):
  File "/Users/dolph/Environments/os/lib/python2.7/site-packages/mock.py", line 1201, in patched
    return func(*args, **keywargs)
  File "/Users/dolph/Projects/keystone/keystone/tests/test_wsgi.py", line 319, in test_keepalive_and_keepidle_set
    self.assertEqual(mock_sock.setsockopt.call_count, 2)
  File "/Users/dolph/Environments/os/lib/python2.7/site-packages/testtools/testcase.py", line 321, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/Users/dolph/Environments/os/lib/python2.7/site-packages/testtools/testcase.py", line 406, in assertThat
    raise mismatch_error
MismatchError: 1 != 2

According to keystone.common.environment.__init__, the expected behavior varies for OS X:

  # Optionally enable keepalive on the wsgi socket.
  # This option isn't available in the OS X version of eventlet

But the test is written without the same flexibility. To demonstrate on OS X:

$ python --version
Python 2.7.6

$ uname
Darwin

$ python -c "import socket; print(socket.TCP_KEEPIDLE)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'TCP_KEEPIDLE'

$ python -c "import eventlet; eventlet.patcher.monkey_patch(socket=True); import socket; print(socket.TCP_KEEPIDLE)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'TCP_KEEPIDLE'

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

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

Changed in keystone:
status: Triaged → In Progress
Dolph Mathews (dolph)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/82520
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=ce0429e5cfd4a5cf336ac437882a675d7920c485
Submitter: Jenkins
Branch: master

commit ce0429e5cfd4a5cf336ac437882a675d7920c485
Author: Dolph Mathews <email address hidden>
Date: Mon Mar 24 09:59:14 2014 -0500

    test tcp_keepidle only if it's available on the current platform

    keystone.common.environment conditionally sets TCP_KEEPIDLE only if it's
    available (as it's not expected to be available in the OS X version of
    eventlet). However, this test always fails on OS X because it's assuming
    that both socket options are always set.

    Change-Id: I368e5414d37ad265d12b9bf6f19d40e0c1f653a9
    Closes-Bug: 1296768

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → icehouse-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: icehouse-rc1 → 2014.1
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.