distro: rename awkwardly named function

WithSingleDistro() doesn't follow go's naming convention for creating
objects (New*). Rename it to NewRegistry() and rename the old
NewRegistry() to NewDefaultRegistry().

The idea is that NewRegistry() can be used to create full Registry
objects from outside the package. NewDefaultRegistry() is a convenience
function that creates a Registry with all known distros.
This commit is contained in:
Lars Karlitski 2020-03-02 22:50:49 +01:00
parent 60301df8f7
commit e5eb673be6
14 changed files with 29 additions and 26 deletions

View file

@ -5,10 +5,10 @@ import (
"github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
)
func NewRegistry() *distro.Registry {
func NewDefaultRegistry() *distro.Registry {
ftest := fedoratest.New()
if ftest == nil {
panic("Attempt to register Fedora test failed")
}
return distro.WithSingleDistro(ftest)
return distro.NewRegistry(ftest)
}

View file

@ -94,7 +94,7 @@ func createBaseStoreFixture() *store.Store {
}
d := test_distro.New()
r := distro_mock.NewRegistry()
r := distro_mock.NewDefaultRegistry()
s := store.New(nil, d, *r)
s.Blueprints[bName] = b
@ -191,7 +191,7 @@ func createStoreWithoutComposesFixture() *store.Store {
}
d := test_distro.New()
r := distro_mock.NewRegistry()
r := distro_mock.NewDefaultRegistry()
s := store.New(nil, d, *r)
s.Blueprints[bName] = b