glance.tests.unit.test_artifacts_plugin_loader unit test failed

Bug #1439951 reported by John Haan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
John Haan

Bug Description

The unit tests in glance.tests.unit.test_artifacts_plugin_loader was failed.

# ./run_tests.sh -N glance.tests.unit.test_artifacts_plugin_loader

glance.tests.unit.test_artifacts_plugin_loader.TestArtifactsLoader
    test_config_validation FAIL
    test_check_function FAIL
    test_basic_loader_func OK 0.01
    test_load FAIL

Below is the result of test_load() unit test.

======================================================================
FAIL: glance.tests.unit.test_artifacts_plugin_loader.TestArtifactsLoader.test_load
----------------------------------------------------------------------
Traceback (most recent call last):
testtools.testresult.real._StringException: Traceback (most recent call last):
  File "/home/jenkins/glance/glance/tests/unit/test_artifacts_plugin_loader.py", line 67, in test_load
    'MyArtifact=%s.v1.artifact:MyArtifact' % self.path]),
  File "/home/jenkins/glance/glance/tests/unit/test_artifacts_plugin_loader.py", line 49, in _setup_loader
    pkg_resources.EntryPoint.parse(art) for art in artifacts]
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2366, in parse
    return cls(res['name'], res['module'], attrs, extras, dist)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2289, in __init__
    raise ValueError("Invalid module name", module_name)
ValueError: ('Invalid module name', '.home.jenkins.glance.glance.tests.unit.test_artifacts_plugin_loader')

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

other results were same to the test_load() test.

The reason why is that I performs unit tests as jenkins user.
Therefore my working directory is /home/jenkins/glance/ .

when getting the path for _setup_loader()

It gets full path of file which means,

path = os.path.splitext(__file__)[0].replace('/', '.')

The full path is raised ValueError for module validation check.

Tags: artifacts
John Haan (yongiman)
description: updated
Changed in glance:
assignee: nobody → John Haan (yongiman)
John Haan (yongiman)
description: updated
Ian Cordasco (icordasc)
tags: added: artifacts
Changed in glance:
status: New → In Progress
John Haan (yongiman)
Changed in glance:
status: In Progress → New
Changed in glance:
status: New → In Progress
Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

Hi. I get the same issue when building in Jenkins. Full log available here:
https://kilo-jessie.pkgs.mirantis.com/job/glance/40/consoleFull

but I don't get it only if building with Jenkins. I also get the same error when building using a normal sbuild environment as my normal "zigo" user. If you wish to rebuild the package in Debian Jessie, you can check the instructions over here:

http://openstack.alioth.debian.org

Revision history for this message
John Haan (yongiman) wrote :

Yes, because the unit test code doesn't consider of custom path of glance source.

If the path of the glance code is like 'glance.tests.unit.test_artifacts_plugin_loader',

the unit test sould be passed.

Now, Im wating of gerrit review.

https://review.openstack.org/#/c/170637/

Can I rebuild the package in Debian?

I think the patched code what I contribute will be uploaded when it reviewed successfully.

Changed in glance:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/170637
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=2fbe06c36c0bd645499f2324796f9617fd3056ac
Submitter: Jenkins
Branch: master

commit 2fbe06c36c0bd645499f2324796f9617fd3056ac
Author: yongiman <email address hidden>
Date: Sat Apr 4 12:03:43 2015 +0900

    Fixed glance.tests.unit.test_artifacts_plugin_loader unit-test

    The test code gets full path of module when _setup_loader() calls.
    Getting full path of mudule could occur test failure
    in indivisual environment.
    Made the test glance.tests.unit.test_artifacts_plugin_loader
    independent of working directory of current user.
    Closes-Bug: #1439951
    Change-Id: I05015cc84aeb48770177c9e26e91cd49aa327657

Changed in glance:
status: In Progress → Fix Committed
Changed in glance:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/209678

Thierry Carrez (ttx)
Changed in glance:
milestone: liberty-1 → 11.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (stable/kilo)

Change abandoned by Flavio Percoco (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/209678
Reason: Abandoning since this is targeting stable/kilo, which is now in a security fixes only period. Furthermore, the bug was not targeted to Kilo and it was released as part of liberty.

The tests fix doesn't seem critical.

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.