repos: make clearer why newRepoRegistry is a var
This commit reworks the `newRepoRegistry` func so that its easier to see that it is a variable so that it can be overriden by the tests. In the tests we want to use the `testrepos` we get from images and in the real implementation we want to use the full repo loader with search-paths and extra repos.
This commit is contained in:
parent
5f6d59013f
commit
e2aeecec8e
1 changed files with 4 additions and 1 deletions
|
|
@ -53,7 +53,7 @@ func parseExtraRepo(extraRepo string) ([]rpmmd.RepoConfig, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
var newRepoRegistry = func(dataDir string, extraRepos []string) (*reporegistry.RepoRegistry, error) {
|
||||
func newRepoRegistryImpl(dataDir string, extraRepos []string) (*reporegistry.RepoRegistry, error) {
|
||||
var dataDirs []string
|
||||
if dataDir != "" {
|
||||
dataDirs = []string{dataDir}
|
||||
|
|
@ -87,3 +87,6 @@ var newRepoRegistry = func(dataDir string, extraRepos []string) (*reporegistry.R
|
|||
|
||||
return reporegistry.NewFromDistrosRepoConfigs(conf), nil
|
||||
}
|
||||
|
||||
// this is a variable to make it overridable in tests
|
||||
var newRepoRegistry = newRepoRegistryImpl
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue