test_get_system_ca_file accesses a test outside of the build directory

Bug #1313257 reported by Matthew Thode
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-heatclient
Triaged
Low
Unassigned

Bug Description

we don't allow this on gentoo, so it gets in the way of test support.

also, this may cause issues as it is a hard coded path.

bug 1308087 may be able to be solved at the same time as this.

Revision history for this message
Angus Salkeld (asalkeld) wrote :

I don't see how it is accessing something out of the tests. It fakes out the first call to os.path.exists() and returns the path name. so the real os.path.exists() never gets called. From what I can see it is not dependant on the actual filesystem at all.

Changed in python-heatclient:
status: New → Incomplete
Revision history for this message
Alex Brandt (alunduil) wrote :

I'm not sure if this is due to a missing mock (doesn't look that way) but here's the full test failure:

FAIL: heatclient.tests.test_common_http.HttpClientTest.test_get_system_ca_file
tags: worker-0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "heatclient/tests/test_common_http.py", line 651, in test_get_system_ca_file
    ca = http.get_system_ca_file()
  File "heatclient/common/http.py", line 50, in get_system_ca_file
    if os.path.exists(ca):
  File "/usr/lib64/python2.7/site-packages/mox3/mox.py", line 814, in __call__
    return mock_method(*params, **named_params)
  File "/usr/lib64/python2.7/site-packages/mox3/mox.py", line 1111, in __call__
    expected_method = self._VerifyMethodCall()
  File "/usr/lib64/python2.7/site-packages/mox3/mox.py", line 1167, in _VerifyMethodCall
    expected = self._PopNextMethod()
  File "/usr/lib64/python2.7/site-packages/mox3/mox.py", line 1153, in _PopNextMethod
    raise UnexpectedMethodCallError(self, None)
UnexpectedMethodCallError: Unexpected method call function.__call__('/etc/ssl/certs/ca-certificates.crt') -> None

To me this looks like a record/replay with a missing assumption but I'm open to suggestions on alternatives to investigate. When I looked at the code everything in this test looked kosher.

I obtained the above test failure by doing the following:

1. extract the tarball from PyPi for 0.2.12 into /tmp
2. enter the expanded directory
3. ensure system python is 2.7.8
4. testr init
5. testr run

I get two failures but will troubleshoot the other independently.

Any pointers would be greatly appreciated as I'm not as familiar with mox3 as I need to be to patch this one.

Revision history for this message
Alex Brandt (alunduil) wrote :

What kind of information is required to move this from incomplete status towards solution? I'm still seeing this failure on version 0.3.0.

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

It looks like os.path.exists is called multiple times, so test_get_system_ca_file line 648 needs to be changed to

  os.path.exists(chosen).MultipleTimes()..AndReturn(chosen)

Changed in python-heatclient:
status: Incomplete → Triaged
importance: Undecided → Low
milestone: none → v0.3.1
Changed in python-heatclient:
milestone: v0.4 → none
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.