Ironic tests unable to run on Macs

Bug #1329077 reported by David Shrewsbury
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Wishlist
milan k

Bug Description

This is definitely a wishlist item.

It would be nice if we could run the Ironic unit test suite on Macs. Problems known thus far:

* -Use of mknod(), which requires super-user privilege- (solved by https://review.openstack.org/99484)
* The sendfile module produces the error "Socket operation on non-socket".

Not sure what other obstacles are in the way since I haven't gotten past those two errors.

Tags: testing
Changed in ironic:
assignee: nobody → David Shrewsbury (dshrews)
status: New → In Progress
tags: added: testing
Dmitry Tantsur (divius)
Changed in ironic:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/99484
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=8f968c3d7faf27b7d765676558fe80ebf331afe0
Submitter: Jenkins
Branch: master

commit 8f968c3d7faf27b7d765676558fe80ebf331afe0
Author: David Shrewsbury <email address hidden>
Date: Wed Jun 11 17:07:03 2014 -0400

    Replace mknod() with chmod()

    Using mknod() can be troublesome on Macs since the underlying system
    call requires super-user privileges. Since its main use here
    is to set the mode of the file (the subsequent call to open() is
    enough to create it), we remove it and replace it with the less
    troublesome chmod().

    Partial-Bug: #1329077

    Change-Id: I30c767792f44d27c6c0179474112015c5ab9bac3

Revision history for this message
David Shrewsbury (dshrews) wrote :

Removing myself as assignee since I'm not currently working on the 'sendfile' portion of this.

Changed in ironic:
assignee: David Shrewsbury (dshrews) → nobody
Dmitry Tantsur (divius)
description: updated
Changed in ironic:
status: In Progress → Triaged
milan k (vetrisko)
Changed in ironic:
assignee: nobody → milan k (vetrisko)
Revision history for this message
milan k (vetrisko) wrote :

I was able to reproduce the sendfile issue:

Failed 1 tests - output below:
==============================

ironic.tests.unit.common.test_glance_service.TestGlanceImageService.test_download_file_url
------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "ironic/tests/unit/common/test_glance_service.py", line 520, in test_download_file_url
        stub_service.download(image_id, writer)
      File "ironic/common/glance_service/v2/image_service.py", line 102, in download
        return self._download(image_id, method='data', data=data)
      File "ironic/common/glance_service/base_image_service.py", line 71, in wrapper
        return func(self, *args, **kwargs)
      File "ironic/common/glance_service/base_image_service.py", line 209, in _download
        sendfile.sendfile(data.fileno(), f.fileno(), 0, filesize)
    OSError: [Errno 38] Socket operation on non-socket

--
milan

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on ironic (master)

Change abandoned by Milan Kováčik (<email address hidden>) on branch: master
Review: https://review.openstack.org/235277
Reason: oops, didn't test it

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

Reviewed: https://review.openstack.org/235277
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=9b446769e537fa4ec9cfc2f2863e73a67727872a
Submitter: Jenkins
Branch: master

commit 9b446769e537fa4ec9cfc2f2863e73a67727872a
Author: dparalen <email address hidden>
Date: Thu Oct 15 13:43:45 2015 +0200

    mocking syscalls to make the tests run on OS X

    ironic.tests.unit.common.test_glance_service.TestGlanceImageService

    The test case intention is to exercise the _download method of
    BaseImageService by asserting that having downloaded an image, the image
    content and the download target file content are the same.

    Since a regular file target is being used, the test case fails in OS X (10.11)
    where the sendfile syscall requires a socket as a target file descriptor
    [1][2]

    The suggested patch intention is both to preserve the sendfile syscall in the
    BaseImageService._download method (because of performance reasons[3]) as well
    as make it possible to run the unit tests on OS X. This is achieved through
    asserting on relevant call patterns rather than call effects by
    mocking/patching the necessary system facilities: open, os.path.getsize and
    sendfile.sendfile.

    [1] man sendfile OS X 10.11 (Oct 2015) [2] _download method implementation,
    ironic/common/glance_service/base_image_service.py [3] simple benchmark
    results, pysendfile home page https://github.com/giampaolo/pysendfile, Oct 2015

    ironic.tests.unit.drivers.modules.irmc.test_deploy.\
      IRMCDeployPrivateMethodsTestCase.test__parse_deploy_info_ok

    The test case intention is to exercise the irmc_deploy._parse_deploy_info
    function by asserting that provided irmc_boot_iso file exists, the function
    parses the input into an expected structure. For that purpose the test case
    utilises /etc/fstab file which it assumes to be always present. Unfortunately,
    on OS X (10.11, Oct 2015) this file is no longer present by default.

    The suggested patch intention is to assert os.path.isfile was called with
    expected irmc_boot_iso path.

    Closes-Bug: #1329077
    Change-Id: Ia907751d6d9eebb59f5ef6899da30b4c79628582

Changed in ironic:
status: In Progress → Fix Committed
Changed in ironic:
status: Fix Committed → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/ironic 4.3.0

This issue was fixed in the openstack/ironic 4.3.0 release.

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.