cmd/image-builder: mock simple integration tests (HMS-10857)#2473
cmd/image-builder: mock simple integration tests (HMS-10857)#2473supakeen wants to merge 1 commit into
Conversation
achilleas-k
left a comment
There was a problem hiding this comment.
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.
|
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. |
c6bf538 to
cc3c92e
Compare
|
Rebased to resolve conflicts. |
|
Something broke during the rebase; let's only ack when it actually goes green this time 😞 |
| assert.NoError(t, err) | ||
| crossArchPipeline := "bootstrap-buildroot" | ||
| crossArchWarning := `WARNING: using experimental cross-architecture building to build "aarch64"` | ||
| crossArchWarning := fmt.Sprintf(`WARNING: using experimental cross-architecture building to build %q`, crossArch.String()) |
There was a problem hiding this comment.
No reason to call String(), I have no problem with this other than it is inconsistent with other fmt.Sprintf where you do nto call .String()
| func sha256For(s string) string { | ||
| h := sha256.New() | ||
| h.Write([]byte(s)) | ||
| return fmt.Sprintf("%x", h.Sum(nil)) | ||
| } |
There was a problem hiding this comment.
This is already defined in manifestgen_test.go. If we figure out a way to share this, maybe from some helpers.go file for tests, it would look cleaner, but not a blocker.
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 <[email protected]>
07fb62f to
5ca4251
Compare
|
Had to rebase for conflicts. |
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 🙁