reporegistry: remove unused ReposByArch() function
Since all calls to `ReposByArch()` have been replaced by `ReposByArchName()`, remove the function and updates tests.
This commit is contained in:
parent
baa2339de4
commit
93c6336e24
2 changed files with 5 additions and 27 deletions
|
|
@ -76,17 +76,6 @@ func (r *RepoRegistry) reposByImageTypeName(distro, arch, imageType string) ([]r
|
|||
return repositories, nil
|
||||
}
|
||||
|
||||
// ReposByArch returns a slice of rpmmd.RepoConfig instances, which should be used for building image types for the
|
||||
// specific architecture. This includes by default all repositories without any image type tags specified.
|
||||
// Depending on the `includeTagged` argument value, repositories with image type tags set will be added to the returned
|
||||
// slice or not.
|
||||
func (r *RepoRegistry) ReposByArch(arch distro.Arch, includeTagged bool) ([]rpmmd.RepoConfig, error) {
|
||||
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)
|
||||
}
|
||||
|
||||
// reposByArchName returns a slice of rpmmd.RepoConfig instances, which should be used for building image types for the
|
||||
// specific architecture and distribution. This includes by default all repositories without any image type tags specified.
|
||||
// Depending on the `includeTagged` argument value, repositories with image type tags set will be added to the returned
|
||||
|
|
|
|||
|
|
@ -277,21 +277,9 @@ func TestReposByArch(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := rr.ReposByArch(tt.args.arch, tt.args.taggedRepos)
|
||||
got, err := rr.ReposByArchName(tt.args.arch.Distro().Name(), tt.args.arch.Name(), tt.args.taggedRepos)
|
||||
assert.Nil(t, err)
|
||||
|
||||
var gotNames []string
|
||||
for _, r := range got {
|
||||
gotNames = append(gotNames, r.Name)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(gotNames, tt.want) {
|
||||
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)
|
||||
assert.Nil(t, err)
|
||||
gotNames = []string{}
|
||||
gotNames := []string{}
|
||||
for _, r := range got {
|
||||
gotNames = append(gotNames, r.Name)
|
||||
}
|
||||
|
|
@ -309,12 +297,13 @@ func TestInvalidReposByArch(t *testing.T) {
|
|||
rr := getTestingRepoRegistry()
|
||||
|
||||
ta := test_distro.TestArch{}
|
||||
td := test_distro.TestDistro{}
|
||||
|
||||
repos, err := rr.ReposByArch(&ta, false)
|
||||
repos, err := rr.ReposByArchName(td.Name(), ta.Name(), false)
|
||||
assert.Nil(t, repos)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
repos, err = rr.ReposByArch(&ta, true)
|
||||
repos, err = rr.ReposByArchName(td.Name(), ta.Name(), false)
|
||||
assert.Nil(t, repos)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue