test_haproxy_context_service_enabled unit test has side effects

Bug #1827061 reported by Dmitrii Shcherbakov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Keystone Charm
Fix Released
Low
Chris MacNaughton

Bug Description

If I run tox -e py36 in a container I get an error in test_haproxy_context_service_enabled which calls is_ipv6_disabled function (it should be mocked out).

unit_tests.test_keystone_contexts.TestKeystoneContexts.test_haproxy_context_service_enabled
-------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/ubuntu/src/canonical/openstack/charm-keystone/.tox/py36/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched'
    b' return func(*args, **keywargs)'
    b' File "/home/ubuntu/src/canonical/openstack/charm-keystone/unit_tests/test_keystone_contexts.py", line 128, in test_haproxy_context_service_enabled'
    b' _ctxt = ctxt()'
    b' File "/home/ubuntu/src/canonical/openstack/charm-keystone/hooks/keystone_context.py", line 143, in __call__'
    b' ctxt = super(HAProxyContext, self).__call__()'
    b' File "/home/ubuntu/src/canonical/openstack/charm-keystone/charmhelpers/contrib/openstack/context.py", line 724, in __call__'
    b" ctxt['ipv6_enabled'] = not is_ipv6_disabled()"
    b' File "/home/ubuntu/src/canonical/openstack/charm-keystone/charmhelpers/contrib/network/ip.py", line 253, in is_ipv6_disabled'
    b' universal_newlines=True)'
    b' File "/usr/lib/python3.6/subprocess.py", line 336, in check_output'
    b' **kwargs).stdout'
    b' File "/usr/lib/python3.6/subprocess.py", line 403, in run'
    b' with Popen(*popenargs, **kwargs) as process:'
    b' File "/usr/lib/python3.6/subprocess.py", line 709, in __init__'
    b' restore_signals, start_new_session)'
    b' File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child'
    b' raise child_exception_type(errno_num, err_msg, err_filename)'
    b"FileNotFoundError: [Errno 2] No such file or directory: 'sysctl': 'sysctl'"
    b''

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote :
Changed in charm-keystone:
status: New → In Progress
assignee: nobody → Chris MacNaughton (chris.macnaughton)
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-keystone (master)

Reviewed: https://review.opendev.org/656526
Committed: https://git.openstack.org/cgit/openstack/charm-keystone/commit/?id=2e3808dd9bc523b626076d9a1c615ce91fc49622
Submitter: Zuul
Branch: master

commit 2e3808dd9bc523b626076d9a1c615ce91fc49622
Author: Chris MacNaughton <email address hidden>
Date: Tue Apr 30 16:57:44 2019 +0200

    Ensure is_ipv6_disabled is properly mocked

    Change-Id: Ibb7df0c2b97801abb15af2d97534535af24205a1
    Closes-Bug: #1827061

Changed in charm-keystone:
status: In Progress → Fix Committed
James Page (james-page)
Changed in charm-keystone:
milestone: none → 19.07
David Ames (thedac)
Changed in charm-keystone:
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.