Unit tests improperly mocking mkdtemp
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tripleo |
Fix Released
|
High
|
Ben Nemec |
Bug Description
This caused the following failure in a unit test job:
2017-08-31 04:19:50.942058 | FAIL: tripleo_
2017-08-31 04:19:50.942070 | tags: worker-7
2017-08-31 04:19:50.942098 | -------
2017-08-31 04:19:50.942116 | Traceback (most recent call last):
2017-08-31 04:19:50.942164 | File "/home/
2017-08-31 04:19:50.942182 | return func(*args, **keywargs)
2017-08-31 04:19:50.942232 | File "/home/
2017-08-31 04:19:50.942248 | action.
2017-08-31 04:19:50.942315 | File "/home/
2017-08-31 04:19:50.942347 | shutil.
2017-08-31 04:19:50.942391 | File "/home/
2017-08-31 04:19:50.942412 | onerror(os.lstat, path, sys.exc_info())
2017-08-31 04:19:50.942453 | File "/home/
2017-08-31 04:19:50.942469 | orig_st = os.lstat(path)
2017-08-31 04:19:50.942497 | FileNotFoundError: [Errno 2] No such file or directory: '/tmp/test123'
I'm not entirely sure how it ever works, but for some reason it's not failing all the time. We shouldn't be mocking mkdtemp in unit tests anyway though - we already have NestedTempfile to clean up any tempfiles we create, and forcing a write to a known system location is probably a security issue too.
tags: |
added: tripleo-common removed: tripleo-comm |
Changed in tripleo: | |
assignee: | nobody → Ben Nemec (bnemec) |
status: | Triaged → In Progress |
Reviewed: https:/ /review. openstack. org/499708 /git.openstack. org/cgit/ openstack/ tripleo- common/ commit/ ?id=0be202dcd10 2ec06c780594729 12938175cc5740
Committed: https:/
Submitter: Jenkins
Branch: master
commit 0be202dcd102ec0 6c7805947291293 8175cc5740
Author: Ben Nemec <email address hidden>
Date: Thu Aug 31 16:29:30 2017 +0000
Don't mock mkdtemp
As far as I can tell there's no reason to do this, and it breaks
the ability for NestedTempfile to clean up after the tests by
forcing the file to go to the system /tmp directory (which I'm
pretty sure is a security issue too...). It's also causing some
weird errors in the gate so let's remove it.
Change-Id: I04f3f569ff904e 002758098cfd90b 5bbb31c6afc
Closes-Bug: 1714306