Port osbuild/images v0.33.0 with dot-notation to composer

Update the osbuild/images to the version which introduces "dot notation"
for distro release versions.

 - Replace all uses of distroregistry by distrofactory.
 - Delete local version of reporegistry and use the one from the
   osbuild/images.
 - Weldr: unify `createWeldrAPI()` and `createWeldrAPI2()` into a single
   `createTestWeldrAPI()` function`.
 - store/fixture: rework fixtures to allow overriding the host distro
   name and host architecture name. A cleanup function to restore the
   host distro and arch names is always part of the fixture struct.
 - Delete `distro_mock` package, since it is no longer used.
 - Bump the required version of osbuild to 98, because the OSCAP
   customization is using the 'compress_results' stage option, which is
   not available in older versions of osbuild.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
Tomáš Hozza 2024-01-08 17:58:49 +01:00 committed by Achilleas Koutsou
parent f6ff8c40dd
commit 625b1578fa
1166 changed files with 154457 additions and 5508 deletions

View file

@ -17,12 +17,11 @@ import (
"testing"
"github.com/osbuild/images/pkg/distro/test_distro"
"github.com/osbuild/images/pkg/distroregistry"
"github.com/osbuild/images/pkg/reporegistry"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
dnfjson_mock "github.com/osbuild/osbuild-composer/internal/mocks/dnfjson"
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
"github.com/osbuild/osbuild-composer/internal/reporegistry"
"github.com/osbuild/osbuild-composer/internal/weldr"
)
@ -63,38 +62,28 @@ func executeTests(m *testing.M) int {
if err != nil {
panic(err)
}
fixture := rpmmd_mock.BaseFixture(path.Join(tmpdir, "/jobs"))
fixture := rpmmd_mock.BaseFixture(path.Join(tmpdir, "/jobs"), test_distro.TestDistro1Name, test_distro.TestArchName)
defer fixture.StoreFixture.Cleanup()
distro1 := test_distro.New()
arch, err := distro1.GetArch(test_distro.TestArchName)
if err != nil {
panic(err)
}
distro2 := test_distro.NewTestDistro("test-distro-2", "platform:test-2", "2")
_, err = fixture.Workers.RegisterWorker(arch.Name())
_, err = fixture.Workers.RegisterWorker(fixture.StoreFixture.HostArchName)
if err != nil {
panic(err)
}
rr := reporegistry.NewFromDistrosRepoConfigs(rpmmd.DistrosRepoConfigs{
test_distro.TestDistroName: {
test_distro.TestArchName: {
fixture.StoreFixture.HostDistroName: {
fixture.StoreFixture.HostArchName: {
{Name: "test-system-repo", BaseURLs: []string{"http://example.com/test/os/test_arch"}},
},
},
})
dr, err := distroregistry.New(distro1, distro1, distro2)
if err != nil {
panic(err)
}
dspath, err := os.MkdirTemp(tmpdir, "")
dnfjsonFixture := dnfjson_mock.Base(dspath)
solver := dnfjson.NewBaseSolver(path.Join(tmpdir, "dnfjson-cache"))
solver.SetDNFJSONPath(dnfjsonPath, dnfjsonFixture)
logger := log.New(os.Stdout, "", 0)
api := weldr.NewTestAPI(solver, arch, dr, rr, logger, fixture.Store, fixture.Workers, "", nil)
api := weldr.NewTestAPI(solver, rr, logger, fixture.StoreFixture, fixture.Workers, "", nil)
server := http.Server{Handler: api}
defer server.Close()