]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cephadm: create functional mock for fchown
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 6 Jun 2023 00:08:49 +0000 (20:08 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:35:13 +0000 (13:35 -0400)
commite0bd41a13b649813fa5a21897347d90e1d8e4cd4
tree83d63c4801bafbd2525c6d4f9cecf0bb34ab85e9
parente673ee48c4e53f4f67190adc8e2bb85019057898
cephadm: create functional mock for fchown

The pyfakefs library apparently doesn't have its own mock for os.fchown.
This means that code using fchown currently calls into a mock with
no affect on the fake fs. For some reason I don't fully understand,
existing test cases work because they don't always follow the pattern
of open-write-rename. Switching to `write_new`, which always does a
rename, breaks some of the assertions performed in the tests on the fake
fs. Add a mock fchown that updates the state of the fake fs so
that converting call sites to use `write_new` will continue to work.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 02b6ce8a44f234aa3fe30fe21d6f28d4e36d7af5)
src/cephadm/tests/fixtures.py