reporegistry: Make ReposByArchName function public
This will be used to select distributions that do not match the host distro.
This commit is contained in:
parent
1b5ca0f163
commit
a330d84739
2 changed files with 9 additions and 9 deletions
|
|
@ -52,7 +52,7 @@ func (r *RepoRegistry) ReposByImageType(imageType distro.ImageType) ([]rpmmd.Rep
|
|||
func (r *RepoRegistry) reposByImageTypeName(distro, arch, imageType string) ([]rpmmd.RepoConfig, error) {
|
||||
repositories := []rpmmd.RepoConfig{}
|
||||
|
||||
archRepos, err := r.reposByArchName(distro, arch, true)
|
||||
archRepos, err := r.ReposByArchName(distro, arch, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ func (r *RepoRegistry) ReposByArch(arch distro.Arch, includeTagged bool) ([]rpmm
|
|||
if arch.Distro() == nil || reflect.ValueOf(arch.Distro()).IsNil() {
|
||||
return nil, fmt.Errorf("there is no distribution associated with the provided architecture")
|
||||
}
|
||||
return r.reposByArchName(arch.Distro().Name(), arch.Name(), includeTagged)
|
||||
return r.ReposByArchName(arch.Distro().Name(), arch.Name(), includeTagged)
|
||||
}
|
||||
|
||||
// reposByArchName returns a slice of rpmmd.RepoConfig instances, which should be used for building image types for the
|
||||
|
|
@ -93,7 +93,7 @@ func (r *RepoRegistry) ReposByArch(arch distro.Arch, includeTagged bool) ([]rpmm
|
|||
// slice or not.
|
||||
//
|
||||
// The method does not verify if the given architecture name is actually part of the specific distribution definition.
|
||||
func (r *RepoRegistry) reposByArchName(distro, arch string, includeTagged bool) ([]rpmmd.RepoConfig, error) {
|
||||
func (r *RepoRegistry) ReposByArchName(distro, arch string, includeTagged bool) ([]rpmmd.RepoConfig, error) {
|
||||
repositories := []rpmmd.RepoConfig{}
|
||||
|
||||
distroRepos, found := r.repos[distro]
|
||||
|
|
|
|||
|
|
@ -132,9 +132,9 @@ func TestInvalidReposByImageType(t *testing.T) {
|
|||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
// TestInvalidReposByImageTypeName tests return values from reposByImageTypeName
|
||||
// TestInvalidreposByImageTypeName tests return values from reposByImageTypeName
|
||||
// for invalid distro name, arch and image type
|
||||
func TestInvalidReposByImageTypeName(t *testing.T) {
|
||||
func TestInvalidreposByImageTypeName(t *testing.T) {
|
||||
rr := getTestingRepoRegistry()
|
||||
|
||||
type args struct {
|
||||
|
|
@ -289,7 +289,7 @@ func TestReposByArch(t *testing.T) {
|
|||
t.Errorf("ReposByArch() =\n got: %#v\n want: %#v", gotNames, tt.want)
|
||||
}
|
||||
|
||||
got, err = rr.reposByArchName(tt.args.arch.Distro().Name(), tt.args.arch.Name(), tt.args.taggedRepos)
|
||||
got, err = rr.ReposByArchName(tt.args.arch.Distro().Name(), tt.args.arch.Name(), tt.args.taggedRepos)
|
||||
assert.Nil(t, err)
|
||||
gotNames = []string{}
|
||||
for _, r := range got {
|
||||
|
|
@ -297,7 +297,7 @@ func TestReposByArch(t *testing.T) {
|
|||
}
|
||||
|
||||
if !reflect.DeepEqual(gotNames, tt.want) {
|
||||
t.Errorf("reposByArchName() =\n got: %#v\n want: %#v", gotNames, tt.want)
|
||||
t.Errorf("ReposByArchName() =\n got: %#v\n want: %#v", gotNames, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -319,7 +319,7 @@ func TestInvalidReposByArch(t *testing.T) {
|
|||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
// TestInvalidReposByArchName tests return values from reposByArchName
|
||||
// TestInvalidReposByArchName tests return values from ReposByArchName
|
||||
// for invalid distro name and arch
|
||||
func TestInvalidReposByArchName(t *testing.T) {
|
||||
rr := getTestingRepoRegistry()
|
||||
|
|
@ -397,7 +397,7 @@ func TestInvalidReposByArchName(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := rr.reposByArchName(tt.args.distro, tt.args.arch, tt.args.taggedRepos)
|
||||
got, err := rr.ReposByArchName(tt.args.distro, tt.args.arch, tt.args.taggedRepos)
|
||||
assert.True(t, tt.want(got, err))
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue