Failed unit test due to permission on /tmp/device_images
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
StarlingX |
Fix Released
|
Low
|
Al Bailey |
Bug Description
Running unit test on local build server (cgts4) failed. Tox reports a unit test failure locally, and another user who had run tox previously owns the permissions to the target folder.
The source code writing to /tmp/device_images needs to be mocked using either a @mock.patch(
It appears that the culprit is this line: https:/
Captured pythonlogging:
~~~~~~~
_host_
None "POST /v1/device_images HTTP/1.0" status: 200 len: 0 time: 0.00612902641296 POST: NestedMultiDict
[Errno 13] Permission denied: '/tmp/device_
Traceback (most recent call last):
File "/tmp/sansari_
return self.app(environ, start_response)
File "/tmp/sansari_
return self.applicatio
File "sysinv/
app_iter = self.app(environ, replacement_
File "/tmp/sansari_
return super(Pecan, self)._
File "/tmp/sansari_
File "/tmp/sansari_
result = controller(*args, **kwargs)
File "/tmp/sansari_
return f(*args, **kwargs)
File "sysinv/
OSError: [Errno 13] Permission denied: '/tmp/device_
======
Totals
======
Ran: 1480 tests in 384.0000 sec.
- Passed: 1449
- Skipped: 28
- Expected Fail: 0
- Unexpected Success: 0
- Failed: 3
Sum of execute time for each test: 15561.9743 sec.
Changed in starlingx: | |
status: | Fix Committed → Fix Released |
The three tox unit tests that are failing are tests that invoke the device_images API and attempt to write to that folder.
The easiest way to reproduce this problem is to make an in-accessible (000 permissions) /tmp/device_images folder, and then run tox for sysinv for the tests that fail (tests. api.test_ device_ image)
mkdir /tmp/device_images
chmod 000 /tmp/device_images
cd $MY_REPO/ stx/config/ sysinv/ sysinv/ sysinv/ test_device_ image
tox -e py27 -- tests.api.
These are the three tests that fail: api.test_ device_ image.TestPostD eviceImage. test_create_ revoke_ key_image api.test_ device_ image.TestPostD eviceImage. test_create_ root_key_ image api.test_ device_ image.TestPostD eviceImage. test_create_ functional_ image
tests.
tests.
tests.