Skip to content

Commit a946081

Browse files
Mikalai Radchukm1kola
Mikalai Radchuk
authored andcommitted
Removes name stuttering
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent 03fe7de commit a946081

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

internal/resolution/variable_sources/bundlesanddependencies/bundles_and_dependencies.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (b *BundlesAndDepsVariableSource) GetVariables(ctx context.Context, entityS
7474
var bundleEntityQueue []*olmentity.BundleEntity
7575
for _, variable := range variables {
7676
switch v := variable.(type) {
77-
case *requiredpackage.RequiredPackageVariable:
77+
case *requiredpackage.Variable:
7878
bundleEntityQueue = append(bundleEntityQueue, v.BundleEntities()...)
7979
}
8080
}

internal/resolution/variable_sources/olm/olm_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ var _ = Describe("OLMVariableSource", func() {
103103
variables, err := olmVariableSource.GetVariables(context.Background(), testEntitySource)
104104
Expect(err).ToNot(HaveOccurred())
105105

106-
packageRequiredVariables := filterVariables[*requiredpackage.RequiredPackageVariable](variables)
106+
packageRequiredVariables := filterVariables[*requiredpackage.Variable](variables)
107107
Expect(packageRequiredVariables).To(HaveLen(2))
108-
Expect(packageRequiredVariables).To(WithTransform(func(bvars []*requiredpackage.RequiredPackageVariable) map[deppy.Identifier]int {
108+
Expect(packageRequiredVariables).To(WithTransform(func(bvars []*requiredpackage.Variable) map[deppy.Identifier]int {
109109
out := map[deppy.Identifier]int{}
110110
for _, variable := range bvars {
111111
out[variable.Identifier()] = len(variable.BundleEntities())

internal/resolution/variable_sources/requiredpackage/required_package.go

+15-15
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,33 @@ import (
1414
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/util/sort"
1515
)
1616

17-
type RequiredPackageVariable struct {
17+
type Variable struct {
1818
*input.SimpleVariable
1919
bundleEntities []*olmentity.BundleEntity
2020
}
2121

22-
func (r *RequiredPackageVariable) BundleEntities() []*olmentity.BundleEntity {
22+
func (r *Variable) BundleEntities() []*olmentity.BundleEntity {
2323
return r.bundleEntities
2424
}
2525

26-
func NewRequiredPackageVariable(packageName string, bundleEntities []*olmentity.BundleEntity) *RequiredPackageVariable {
26+
func NewRequiredPackageVariable(packageName string, bundleEntities []*olmentity.BundleEntity) *Variable {
2727
id := deppy.IdentifierFromString(fmt.Sprintf("required package %s", packageName))
2828
entityIDs := make([]deppy.Identifier, 0, len(bundleEntities))
2929
for _, bundle := range bundleEntities {
3030
entityIDs = append(entityIDs, bundle.ID)
3131
}
32-
return &RequiredPackageVariable{
32+
return &Variable{
3333
SimpleVariable: input.NewSimpleVariable(id, constraint.Mandatory(), constraint.Dependency(entityIDs...)),
3434
bundleEntities: bundleEntities,
3535
}
3636
}
3737

38-
var _ input.VariableSource = &RequiredPackageVariableSource{}
38+
var _ input.VariableSource = &VariableSource{}
3939

40-
type RequiredPackageOption func(*RequiredPackageVariableSource) error
40+
type Option func(*VariableSource) error
4141

42-
func InVersionRange(versionRange string) RequiredPackageOption {
43-
return func(r *RequiredPackageVariableSource) error {
42+
func InVersionRange(versionRange string) Option {
43+
return func(r *VariableSource) error {
4444
if versionRange != "" {
4545
vr, err := semver.ParseRange(versionRange)
4646
if err == nil {
@@ -55,8 +55,8 @@ func InVersionRange(versionRange string) RequiredPackageOption {
5555
}
5656
}
5757

58-
func InChannel(channelName string) RequiredPackageOption {
59-
return func(r *RequiredPackageVariableSource) error {
58+
func InChannel(channelName string) Option {
59+
return func(r *VariableSource) error {
6060
if channelName != "" {
6161
r.channelName = channelName
6262
r.predicates = append(r.predicates, predicates.InChannel(channelName))
@@ -65,18 +65,18 @@ func InChannel(channelName string) RequiredPackageOption {
6565
}
6666
}
6767

68-
type RequiredPackageVariableSource struct {
68+
type VariableSource struct {
6969
packageName string
7070
versionRange string
7171
channelName string
7272
predicates []input.Predicate
7373
}
7474

75-
func NewRequiredPackage(packageName string, options ...RequiredPackageOption) (*RequiredPackageVariableSource, error) {
75+
func NewRequiredPackage(packageName string, options ...Option) (*VariableSource, error) {
7676
if packageName == "" {
7777
return nil, fmt.Errorf("package name must not be empty")
7878
}
79-
r := &RequiredPackageVariableSource{
79+
r := &VariableSource{
8080
packageName: packageName,
8181
predicates: []input.Predicate{predicates.WithPackageName(packageName)},
8282
}
@@ -88,7 +88,7 @@ func NewRequiredPackage(packageName string, options ...RequiredPackageOption) (*
8888
return r, nil
8989
}
9090

91-
func (r *RequiredPackageVariableSource) GetVariables(ctx context.Context, entitySource input.EntitySource) ([]deppy.Variable, error) {
91+
func (r *VariableSource) GetVariables(ctx context.Context, entitySource input.EntitySource) ([]deppy.Variable, error) {
9292
resultSet, err := entitySource.Filter(ctx, input.And(r.predicates...))
9393
if err != nil {
9494
return nil, err
@@ -106,7 +106,7 @@ func (r *RequiredPackageVariableSource) GetVariables(ctx context.Context, entity
106106
}, nil
107107
}
108108

109-
func (r *RequiredPackageVariableSource) notFoundError() error {
109+
func (r *VariableSource) notFoundError() error {
110110
// TODO: update this error message when/if we decide to support version ranges as opposed to fixing the version
111111
// context: we originally wanted to support version ranges and take the highest version that satisfies the range
112112
// during the upstream call on the 2023-04-11 we decided to pin the version instead. But, we'll keep version range

internal/resolution/variable_sources/requiredpackage/required_package_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestRequiredPackage(t *testing.T) {
2222

2323
var _ = Describe("RequiredPackageVariable", func() {
2424
var (
25-
rpv *requiredpackage.RequiredPackageVariable
25+
rpv *requiredpackage.Variable
2626
packageName string
2727
bundleEntities []*olmentity.BundleEntity
2828
)
@@ -62,7 +62,7 @@ var _ = Describe("RequiredPackageVariable", func() {
6262

6363
var _ = Describe("RequiredPackageVariableSource", func() {
6464
var (
65-
rpvs *requiredpackage.RequiredPackageVariableSource
65+
rpvs *requiredpackage.VariableSource
6666
packageName string
6767
mockEntitySource input.EntitySource
6868
)
@@ -102,7 +102,7 @@ var _ = Describe("RequiredPackageVariableSource", func() {
102102
variables, err := rpvs.GetVariables(context.TODO(), mockEntitySource)
103103
Expect(err).NotTo(HaveOccurred())
104104
Expect(variables).To(HaveLen(1))
105-
reqPackageVar, ok := variables[0].(*requiredpackage.RequiredPackageVariable)
105+
reqPackageVar, ok := variables[0].(*requiredpackage.Variable)
106106
Expect(ok).To(BeTrue())
107107
Expect(reqPackageVar.Identifier()).To(Equal(deppy.IdentifierFromString(fmt.Sprintf("required package %s", packageName))))
108108

@@ -131,7 +131,7 @@ var _ = Describe("RequiredPackageVariableSource", func() {
131131
variables, err := rpvs.GetVariables(context.TODO(), mockEntitySource)
132132
Expect(err).NotTo(HaveOccurred())
133133
Expect(variables).To(HaveLen(1))
134-
reqPackageVar, ok := variables[0].(*requiredpackage.RequiredPackageVariable)
134+
reqPackageVar, ok := variables[0].(*requiredpackage.Variable)
135135
Expect(ok).To(BeTrue())
136136
Expect(reqPackageVar.Identifier()).To(Equal(deppy.IdentifierFromString(fmt.Sprintf("required package %s", packageName))))
137137

0 commit comments

Comments
 (0)