Skip to content

cmd/image-builder: mock simple integration tests (HMS-10857)#2473

Merged
supakeen merged 1 commit into
osbuild:mainfrom
supakeen:mock-unit-tests
Jul 14, 2026
Merged

cmd/image-builder: mock simple integration tests (HMS-10857)#2473
supakeen merged 1 commit into
osbuild:mainfrom
supakeen:mock-unit-tests

Conversation

@supakeen

Copy link
Copy Markdown
Member

Mock the integration tests that are easy and straightforward to mock. This reduces the test time significantly as we're not performing real dependency solving anymore in most of the tests.


Note this doesn't really make things faster that much. The test suite still takes long as almost every test calls main.Run() which loads distribution definitions which takes 2-3 seconds for every test.

We also can't make the tests parallel without rewriting the entire mocking strategy since we're mocking globals 🙁

@supakeen
supakeen requested a review from a team as a code owner June 29, 2026 07:26
@supakeen
supakeen requested review from achilleas-k, avitova and lzap June 29, 2026 07:26
achilleas-k
achilleas-k previously approved these changes Jun 29, 2026

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice.

I'm sure we can get more improvements to the loading times once we're done with the merge and can focus on the loader.

@supakeen

Copy link
Copy Markdown
Member Author

It seems that with some (new?) tests we now have downstream failures in RPM builds or is this caused by this PR. I'll take a look in the morning.

@supakeen
supakeen force-pushed the mock-unit-tests branch 5 times, most recently from c6bf538 to cc3c92e Compare July 4, 2026 07:13
@supakeen
supakeen requested a review from achilleas-k July 6, 2026 12:17
@supakeen

supakeen commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Rebased to resolve conflicts.

achilleas-k
achilleas-k previously approved these changes Jul 6, 2026
@supakeen

supakeen commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

Something broke during the rebase; let's only ack when it actually goes green this time 😞

achilleas-k
achilleas-k previously approved these changes Jul 6, 2026
avitova
avitova previously approved these changes Jul 9, 2026
Comment thread cmd/image-builder/main_test.go Outdated
Comment thread cmd/image-builder/main_test.go Outdated
@supakeen
supakeen added this pull request to the merge queue Jul 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 9, 2026
@supakeen
supakeen dismissed stale reviews from avitova and achilleas-k via 5ca4251 July 10, 2026 05:57
@supakeen

Copy link
Copy Markdown
Member Author

Had to rebase for conflicts.

@supakeen
supakeen requested review from achilleas-k and avitova July 10, 2026 05:57
achilleas-k
achilleas-k previously approved these changes Jul 13, 2026

@brlane-rht brlane-rht left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than using new.

Comment thread cmd/image-builder/export_test.go Outdated
Comment thread cmd/image-builder/upload_test.go
Mock the integration tests that are easy and straightforward to mock.
This reduces the test time significantly as we're not performing real
dependency solving anymore in most of the tests.

The resolvers are duplicated here but could later be shared.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>

@achilleas-k achilleas-k left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY

@supakeen
supakeen added this pull request to the merge queue Jul 14, 2026
Merged via the queue into osbuild:main with commit 09dcb28 Jul 14, 2026
50 of 51 checks passed
@supakeen
supakeen deleted the mock-unit-tests branch July 14, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants