Closed dongsupark closed 3 months ago
It would be nice to have unit tests in this PR, but without root privileges, unit tests would fail.
According to my research, Rust does not have a clear and nice way of mocking unit tests like Python.
If we really want to do that in Rust, in theory we could create mount-specific unit tests that can be executed only when cargo test
runs with privileges.
On the other hand, I think in general running mount/umount commands on system devices should be rather in integration tests, not in unit tests.
I agree that anything running mount/unmount should be an integration test. Unit tests should not require privilege or necessarily even run on the "target" system.
Functions
mount_media
andremove_media
were removed in https://github.com/Azure/azure-init/pull/57. To parse a ovf_env file, however, both mount_media and remove_media are necessary. Bring back the functions.Adjust return types according to the new LibError interface as well.
TODO: unit test for the functions would be also nice.
Testing done
TBD