dashboard: 4 unit tests failure due to xdpyinfo useage

Bug #1604711 reported by Thomas Goirand
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sahara
Invalid
Undecided
Unassigned

Bug Description

Building sahara-dashboard Debian package for Newton b2 leads to the below unit test errors. This cannot work, because in the VM which builds the package, there's no $DISPLAY env var (the VM doesn't run X-Window), and therefore, xdpyinfo returns nothing.

If I missed something in the run test env let me know. FYI, I'm running unit tests using:

        NOSE_WITH_OPENSTACK=1 \
                NOSE_OPENSTACK_COLOR=1 \
                NOSE_OPENSTACK_RED=0.05 \
                NOSE_OPENSTACK_YELLOW=0.025 \
                NOSE_OPENSTACK_SHOW_ELAPSED=1 \
                DJANGO_SETTINGS_MODULE=saharadashboard.test.settings \
                python-coverage run \
                $(CURDIR)/manage.py test sahara_dashboard --settings=sahara_dashboard.test.settings

Is there something else I should do before running that? Using the provided run_tests.sh is too gate-centric to be usable in a packaging context.

======================================================================
ERROR: Failure: CalledProcessError (Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/zigo/sources/openstack/newton/sahara-dashboard/build-area/sahara-dashboard-5.0.0~b2/sahara_dashboard/test/integration_tests/helpers.py", line 17, in <module>
    from openstack_dashboard.test.integration_tests import helpers
  File "/usr/lib/python2.7/dist-packages/openstack_dashboard/test/integration_tests/helpers.py", line 45, in <module>
    shell=True).split()[1].split('x')
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1

======================================================================
ERROR: Failure: CalledProcessError (Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/zigo/sources/openstack/newton/sahara-dashboard/build-area/sahara-dashboard-5.0.0~b2/sahara_dashboard/test/integration_tests/tests/test_crud.py", line 13, in <module>
    from sahara_dashboard.test.integration_tests.helpers import SaharaTestCase
  File "/home/zigo/sources/openstack/newton/sahara-dashboard/build-area/sahara-dashboard-5.0.0~b2/sahara_dashboard/test/integration_tests/helpers.py", line 17, in <module>
    from openstack_dashboard.test.integration_tests import helpers
  File "/usr/lib/python2.7/dist-packages/openstack_dashboard/test/integration_tests/helpers.py", line 45, in <module>
    shell=True).split()[1].split('x')
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1

======================================================================
ERROR: Failure: CalledProcessError (Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/zigo/sources/openstack/newton/sahara-dashboard/build-area/sahara-dashboard-5.0.0~b2/sahara_dashboard/test/integration_tests/tests/test_sahara_image_registry.py", line 13, in <module>
    from openstack_dashboard.test.integration_tests import helpers
  File "/usr/lib/python2.7/dist-packages/openstack_dashboard/test/integration_tests/helpers.py", line 45, in <module>
    shell=True).split()[1].split('x')
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1

======================================================================
ERROR: Failure: CalledProcessError (Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/zigo/sources/openstack/newton/sahara-dashboard/build-area/sahara-dashboard-5.0.0~b2/sahara_dashboard/test/integration_tests/tests/test_sahara_job_binaries.py", line 13, in <module>
    from openstack_dashboard.test.integration_tests import helpers
  File "/usr/lib/python2.7/dist-packages/openstack_dashboard/test/integration_tests/helpers.py", line 45, in <module>
    shell=True).split()[1].split('x')
  File "/usr/lib/python2.7/subprocess.py", line 574, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command 'xdpyinfo | grep dimensions' returned non-zero exit status 1

Tags: dashboard
Revision history for this message
Luigi Toscano (ltoscano) wrote :

The helper class come from horizon, do you see the same error when running horizon tests or the tests for other dashboards?

The code in that class probably needs a better exception handler on the first subprocess call:

 if not subprocess.call('which xdpyinfo > /dev/null 2>&1', shell=True):
    SCREEN_SIZE = subprocess.check_output('xdpyinfo | grep dimensions',
                                          shell=True).split()[1].split('x')
else:
    SCREEN_SIZE = (None, None)
    LOGGER.info("X11 isn't installed. Should use xvfb to run tests.")

Missing exception handler aside (which is an horizon bug), it looks like xvfb is required.

Revision history for this message
Vitalii Gridnev (vgridnev) wrote :

Looks like command your are running also triggers executing integration tests. You should exclude them

Revision history for this message
Vitalii Gridnev (vgridnev) wrote :

--exclude-dir=sahara_dashboard/test/integration_tests"

Changed in sahara:
status: New → Incomplete
Changed in sahara:
status: Incomplete → Invalid
Luigi Toscano (ltoscano)
tags: added: dashboard
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.