Use RepoRegistry in composer and Weldr API
Modify composer to use RepoRegistry, instead of loading the host repositories, when initializing WeldrAPI. Modify WeldrAPI to use RepoRegistry, instead of a map of repository definitions. Make sure that the RepoRegistry method specific to image type is used in Welder where appropriate. Specifically when depsolving a Blueprint, which is used to build a specific image type. Update Weldr API unit tests to reflect the change. Add a new method to RepoRegistry, allowing to get list of repositories, which should be used for building an image for a given architecture, without specifying the exact image type. Add relevant unit tests. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
fba9fe1072
commit
aa6665ad01
6 changed files with 361 additions and 34 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/test_distro"
|
||||
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/reporegistry"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/store"
|
||||
"github.com/osbuild/osbuild-composer/internal/target"
|
||||
|
|
@ -34,14 +35,22 @@ import (
|
|||
func createWeldrAPI(tempdir string, fixtureGenerator rpmmd_mock.FixtureGenerator) (*API, *store.Store) {
|
||||
fixture := fixtureGenerator(tempdir)
|
||||
rpm := rpmmd_mock.NewRPMMDMock(fixture)
|
||||
repos := []rpmmd.RepoConfig{{Name: "test-id", BaseURL: "http://example.com/test/os/x86_64", CheckGPG: true}}
|
||||
|
||||
rr := reporegistry.NewFromDistrosRepoConfigs(rpmmd.DistrosRepoConfigs{
|
||||
test_distro.TestDistroName: {
|
||||
test_distro.TestArchName: {
|
||||
{Name: "test-id", BaseURL: "http://example.com/test/os/x86_64", CheckGPG: true},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
d := test_distro.New()
|
||||
arch, err := d.GetArch(test_distro.TestArchName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return New(rpm, arch, d, repos, nil, fixture.Store, fixture.Workers, ""), fixture.Store
|
||||
return New(rpm, arch, d, rr, nil, fixture.Store, fixture.Workers, ""), fixture.Store
|
||||
}
|
||||
|
||||
func TestBasic(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue