Uploaded image for project: 'Insights Experiences'
  1. Insights Experiences
  2. HMS-9355

Many: refactor 'osbuild-depsolve-dnf' mocking in tests to support refactoring in `osbuild/images`

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • Image Builder
    • None

      The `dnfjson` package in `osbuild/images` has been renamed to `depsolvednf`. Moreover, data structures from `rpmmd` are being heavily used by the depsolving library. `rpmmd` needs to be refactored and consolidated to prepare for SBOM generation re-architecture. This will also include changes to the `osbuild-depsolve-dnf` tool.

      To make it easier to port current and future changes in the `osbuild/images` repository to composer, this PR simplifies how `osbuild-depsolve-dnf` is being mocked in (weldr API) unit tests.

      Previously, unit tests were compiling a mock binary which had to mimic `osbuild-depsolve-dnf` API and behavior, while in reality, the goal should have been to mock the `dnfjson` package API from `osbuild/images`. This PR moves the mocking to the correct layer, which makes osbuild-composer unit tests less coupled with the underlying implementation of depsolving.

      Note that the number of added new lines of code is skewed by the test case structures reformatting in the `internal/weldr/api_test.go`, so in reality, much more code has been removed.

      /jira-epic HMS-8910

              thozza@redhat.com Tomas Hozza
              imagebuilder-bot Image-Builder Bot
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: