-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add priority option for repo configuration #5
Conversation
Currently there's no user-specified ordering for the defined repositories and because of the way the code works it will (counter intuitively) choose RPMs from repos later in the list. This change introduces an explicit repo priority so that users can force ordering of repos to choose RPMs from.
@@ -102,11 +102,17 @@ func (r *RepoReducer) Resolve(packages []string) (matched []string, involved []* | |||
if !found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this RepoReducer.Resolve
unit deserves a unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I agree in practice, if we want to add unit tests for this I think we should handle this separately as the change here is (relatively) narrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a test, it's arguably incomplete. Is the problem that it's hard to add a test to cover this new logic? It doesn't have to cover everything that was here already.
Separating ourselves from the concrete implementation of the CacheHelper via an interface makes it easier to write tests against RepoReducer.
The lang option never gets used anywhere (and is not even hooked up as a proper argument!) so we can safely prune it.
All of the uses of the reducer have the exact same sequence. We can capture this sequence and then use it as our model for testing the reducer.
This is the first step in de-couple the repo data loading from the reducer itself to enable easier testing of the reducer.
In order to completely decouple the loading process from the general reducer algorithm we need to decouple it from the RepoReducer itself. This change converts to returning the package list and accepting the inputs as parameters to enable this decoupling.
Remove unused RPMReader method
RepoLoader captures the repository package loading process separately from the reducer and introduces an interface between them to make testing the reducer easier.
bumping all golang deps to close a few dependabots issues
deps: bumps all golang deps
Reduce some tech debt by using cmp.Or instead of multi level ifs.
Will make use of slices.Sort and slices.SortFunc so we can sort dictionary keys before we send them to the sat resolver
Check if by making the input to sat stable the output is also stable
Make sure the sat solver output is deterministic and reproducible by making the input order stable
Make sat reproducible
The loader should also capture the provide-map builder so as to keep the reducer itself fairly simple. This change pulls the remainder of the reducer's Load() method into the loader and refines the interface to the loader to help with this.
Refactor reducer to enable testing
Now that we have the loading code exposed in a way that is a bit more manageable we can add some tests around it. We also add a set of helpers in a separate source file which will be used by tests for the reducer itself.
This change approximates the reducer operations and provides tests for them. It leverages the existing helpers produced for the loader_test to reduce the repetitiveness of constructing the test inputs.
The first iteration of this change produced a scenario where we'd drop packages that have a different version which we previously were retaining. This change fixes that and includes differently versioned packages while accounting for the repository priority otherwise.
Currently there's no user-specified ordering for the defined repositories and because of the way the code works it will (counter intuitively) choose RPMs from repos later in the list.
This change introduces an explicit repo priority so that users can force ordering of repos to choose RPMs from.