Unit tests with filesystem-related mocks fail in SeLinuxGuard when run on RHEL or CentOS
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Undecided
|
Jason Zions |
Bug Description
When the unit tests are run on RHEL or CentOS, some tests which mock filesystem directories so as to "lie" about things can cause util.SeLinuxGuard to fail. The SeLinuxGuard does nothing in environments which lack the selinux python module or when that module reports that selinux is not enabled. When the guard is functional, though, it can be confused by some mocks used in various tests.
tests.unittests
tests.unittests
tests.unittests
tests.unittests
tests.unittests
In the first four cases, the tests mock os.path.realpath by remapping path prefixes to point to a temporary directory, but SeLinuxGuard doesn't see the mapping. In the last case, the test case mocks os.path.islink to lie and claim a directory is actually a symlink, but code invoked by SeLinuxGuard gets very confused when it tries to treat the (quite real) directory as if it were a symlink.
Related branches
- Ryan Harper: Approve
- Dan Watkins: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 38 lines (+7/-1)2 files modifiedtests/unittests/test_datasource/test_azure.py (+3/-0)
tests/unittests/test_net.py (+4/-1)
Changed in cloud-init: | |
status: | New → In Progress |
assignee: | nobody → Jason Zions (jasonzio) |
This bug is fixed with commit c8c32515 to cloud-init on branch master. /git.launchpad. net/cloud- init/commit/ ?id=c8c32515
To view that commit see the following URL:
https:/