]> git.apps.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)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 6 Jun 2023 18:12:58 +0000 (14:12 -0400)
commit02b6ce8a44f234aa3fe30fe21d6f28d4e36d7af5
tree9b07d61de310d004da91a06bcad9679be821b28c
parentd5794f3441cf8da3c9716e796f41f2585d80adcb
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>
src/cephadm/tests/fixtures.py