Skip to content

Commit

Permalink
cloudapi: update test to use repos from images
Browse files Browse the repository at this point in the history
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
osbuild/images#1179
is merged.
  • Loading branch information
mvo5 committed Jan 29, 2025
1 parent c1a60d8 commit 0a86a28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions internal/cloudapi/v2/compose_test.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion osbuild-composer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ install -m 0644 -vp vendor/github.com/osbuild/images/data/repositories/centos-*
%else
# All other CentOS versions support building for the same version
install -m 0644 -vp vendor/github.com/osbuild/images/data/repositories/centos-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
install -m 0644 -vp vendor/github.com/osbuild/images/data/repositories/centos-stream-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
# centos-stream-* are symlinks
cp -a repositories/centos-stream-%{centos}* %{buildroot}%{_datadir}/osbuild-composer/repositories/
%endif

%else
Expand Down

0 comments on commit 0a86a28

Please sign in to comment.