cloudapi: update test to use repos from images

This commit updates the cloudapi test that uses the real repositories
to use the version of those from the "images" library. Composer
no longer carries the default repos.

Note that this can most likely be simplified once
https://github.com/osbuild/images/pull/1179
is merged.
This commit is contained in:
Michael Vogt 2025-01-29 22:08:24 +01:00 committed by Tomáš Hozza
parent a9fcf2a411
commit 5906c554f6
2 changed files with 9 additions and 7 deletions

View file

@ -1,8 +1,10 @@
package v2
import (
"io/fs"
"testing"
"github.com/osbuild/images/data/repositories"
"github.com/osbuild/images/pkg/customizations/subscription"
"github.com/osbuild/images/pkg/disk"
"github.com/osbuild/images/pkg/distrofactory"
@ -811,9 +813,9 @@ func TestGetImageRequests_NoRepositories(t *testing.T) {
Repositories: []Repository{},
},
}
// NOTE: current directory is the location of this file, back up so it can use ./repositories/
rr, err := reporegistry.New([]string{"../../../"})
reposConf, err := reporegistry.LoadAllRepositoriesFromFS([]fs.FS{repos.FS})
require.NoError(t, err)
rr := reporegistry.NewFromDistrosRepoConfigs(reposConf)
got, err := request.GetImageRequests(distrofactory.NewDefault(), rr)
assert.NoError(t, err)
require.Len(t, got, 1)
@ -837,9 +839,9 @@ func TestGetImageRequests_BlueprintDistro(t *testing.T) {
Distro: common.ToPtr("fedora-39"),
},
}
// NOTE: current directory is the location of this file, back up so it can use ./repositories/
rr, err := reporegistry.New([]string{"../../../"})
reposConf, err := reporegistry.LoadAllRepositoriesFromFS([]fs.FS{repos.FS})
require.NoError(t, err)
rr := reporegistry.NewFromDistrosRepoConfigs(reposConf)
got, err := request.GetImageRequests(distrofactory.NewDefault(), rr)
assert.NoError(t, err)
require.Len(t, got, 1)