← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1825253] [NEW] Unit tests with filesystem-related mocks fail in SeLinuxGuard when run on RHEL or CentOS

 

Public bug reported:

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.test_datasource.test_azure.TestCanDevBeReformatted.test_one_partition_ntfs_empty_with_dataloss_file_is_true

tests.unittests.test_datasource.test_azure.TestCanDevBeReformatted.test_one_partition_ntfs_populated_false

tests.unittests.test_datasource.test_azure.TestCanDevBeReformatted.test_one_partition_through_realpath_is_true

tests.unittests.test_datasource.test_azure.TestCanDevBeReformatted.test_two_partitions_ntfs_populated_false

tests.unittests.test_net.TestNetplanPostcommands.test_netplan_postcmds

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.

** Affects: cloud-init
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1825253

Title:
  Unit tests with filesystem-related mocks fail in SeLinuxGuard when run
  on RHEL or CentOS

Status in cloud-init:
  New

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.test_datasource.test_azure.TestCanDevBeReformatted.test_one_partition_ntfs_empty_with_dataloss_file_is_true

  tests.unittests.test_datasource.test_azure.TestCanDevBeReformatted.test_one_partition_ntfs_populated_false

  tests.unittests.test_datasource.test_azure.TestCanDevBeReformatted.test_one_partition_through_realpath_is_true

  tests.unittests.test_datasource.test_azure.TestCanDevBeReformatted.test_two_partitions_ntfs_populated_false

  tests.unittests.test_net.TestNetplanPostcommands.test_netplan_postcmds

  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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1825253/+subscriptions


Follow ups