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:
parent
60301df8f7
commit
e5eb673be6
14 changed files with 29 additions and 26 deletions
|
|
@ -34,7 +34,7 @@ func TestBasic(t *testing.T) {
|
|||
|
||||
for _, c := range cases {
|
||||
distroStruct := test_distro.New()
|
||||
registry := distro_mock.NewRegistry()
|
||||
registry := distro_mock.NewDefaultRegistry()
|
||||
api := jobqueue.New(nil, store.New(nil, distroStruct, *registry))
|
||||
|
||||
test.TestNonJsonRoute(t, api, false, c.Method, c.Path, c.Body, c.ExpectedStatus, c.ExpectedResponse)
|
||||
|
|
@ -44,7 +44,7 @@ func TestBasic(t *testing.T) {
|
|||
func TestCreate(t *testing.T) {
|
||||
id, _ := uuid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff")
|
||||
distroStruct := test_distro.New()
|
||||
registry := distro_mock.NewRegistry()
|
||||
registry := distro_mock.NewDefaultRegistry()
|
||||
store := store.New(nil, distroStruct, *registry)
|
||||
api := jobqueue.New(nil, store)
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ func TestCreate(t *testing.T) {
|
|||
func testUpdateTransition(t *testing.T, from, to string, expectedStatus int, expectedResponse string) {
|
||||
id, _ := uuid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff")
|
||||
distroStruct := test_distro.New()
|
||||
registry := distro_mock.NewRegistry()
|
||||
registry := distro_mock.NewDefaultRegistry()
|
||||
store := store.New(nil, distroStruct, *registry)
|
||||
api := jobqueue.New(nil, store)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ func (e *TargetsError) Error() string {
|
|||
}
|
||||
|
||||
func (job *Job) Run(uploader LocalTargetUploader) (*common.ComposeResult, error) {
|
||||
distros := distro.NewRegistry([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"})
|
||||
distros := distro.NewDefaultRegistry([]string{"/etc/osbuild-composer", "/usr/share/osbuild-composer"})
|
||||
d := distros.GetDistro(job.Distro)
|
||||
if d == nil {
|
||||
return nil, fmt.Errorf("unknown distro: %s", job.Distro)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue