Azure / azure-init

A minimal provisioning agent designed for Azure Linux VMs.
MIT License
7 stars 10 forks source link

bring back mount_media, remove_media #62

Closed dongsupark closed 3 months ago

dongsupark commented 4 months ago

Functions mount_media and remove_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

dongsupark commented 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.

cjp256 commented 3 months ago

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.