-
Story
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
Within the MCD, there exist numerous functions whose purpose is to write files onto the filesystem and call various commands once those files are written. For example, these functions (https://github.com/openshift/machine-config-operator/blob/cbd7d9514d6a03c84192058edae7a6ff4f9d6941/pkg/daemon/update.go#L1632-L1679) operate within the context of the main Daemon object. As such, they can be very difficult to use in a testing context, requiring things such as overriding global variables. This makes writing test cases that handle edge-cases around filesystem mutations very difficult as they must operate within the context of the MCD.
Done When:
- A new object is created that writes files, systemd units, etc. to the filesystem which contains its own state around where the systemd path is, etc.
- A new object is created that performs filesystem validation, using the same configuration struct as the aforementioned object.
- A potential idea for these is to use something like https://github.com/spf13/afero to abstract the filesystem mutations so that tests for the new objects can operate with a completely in-memory filesystem.
- There is a minimum of 90% test coverage for the new objects.
- These new objects are integrated into the MCD using dependency injection which would permit the core MCD to be tested without actually mutating the underlying filesystem. However, writing such a test for the MCD is not in-scope for this card.