weldr: pin a real Arch object, rather than a string
weldr needs to know the host architecture. Rather than pinning a string, pin a real Arch object, and query its name when we need it. This verifies the validitiy of the architecture for the given distro before it is passed to weldr, rather than lazily on demand. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
bbd8dc338d
commit
f201fc84b7
4 changed files with 24 additions and 11 deletions
|
|
@ -13,7 +13,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
test_distro "github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/fedoratest"
|
||||
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/weldr"
|
||||
|
|
@ -209,10 +209,14 @@ func TestMain(m *testing.M) {
|
|||
// Create a mock API server listening on the temporary socket
|
||||
fixture := rpmmd_mock.BaseFixture()
|
||||
rpm := rpmmd_mock.NewRPMMDMock(fixture)
|
||||
distro := test_distro.New()
|
||||
distro := fedoratest.New()
|
||||
arch, err := distro.GetArch("x86_64")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
repos := []rpmmd.RepoConfig{{Id: "test-id", BaseURL: "http://example.com/test/os/test_arch"}}
|
||||
logger := log.New(os.Stdout, "", 0)
|
||||
api := weldr.New(rpm, "test_arch", distro, repos, logger, fixture.Store)
|
||||
api := weldr.New(rpm, arch, distro, repos, logger, fixture.Store)
|
||||
server := http.Server{Handler: api}
|
||||
defer server.Close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue