Uploaded image for project: 'Machine Config Operator'
  1. Machine Config Operator
  2. MCO-439

Refactor filesystem functions in MCD

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • 0

      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.

              Unassigned Unassigned
              zzlotnik@redhat.com Zack Zlotnik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: