Skip to content

Commit 03fe7de

Browse files
Mikalai Radchukm1kola
Mikalai Radchuk
authored andcommitted
Renames package with underscores
Signed-off-by: Mikalai Radchuk <[email protected]>
1 parent 67aa33a commit 03fe7de

File tree

9 files changed

+75
-75
lines changed

9 files changed

+75
-75
lines changed

internal/controllers/operator_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import (
4141

4242
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
4343
"github.com/operator-framework/operator-controller/internal/controllers/validators"
44-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
44+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundlesanddependencies"
4545
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/entity"
4646
)
4747

@@ -247,7 +247,7 @@ func mapBDStatusToInstalledCondition(existingTypedBundleDeployment *rukpakv1alph
247247
func (r *OperatorReconciler) getBundleEntityFromSolution(solution *solver.Solution, packageName string) (*entity.BundleEntity, error) {
248248
for _, variable := range solution.SelectedVariables() {
249249
switch v := variable.(type) {
250-
case *bundles_and_dependencies.BundleVariable:
250+
case *bundlesanddependencies.BundleVariable:
251251
entityPkgName, err := v.BundleEntity().PackageName()
252252
if err != nil {
253253
return nil, err

internal/resolution/variable_sources/bundles_and_dependencies/bundles_and_dependencies.go renamed to internal/resolution/variable_sources/bundlesanddependencies/bundles_and_dependencies.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package bundles_and_dependencies
1+
package bundlesanddependencies
22

33
import (
44
"context"
@@ -11,7 +11,7 @@ import (
1111
"github.com/operator-framework/deppy/pkg/deppy/input"
1212

1313
olmentity "github.com/operator-framework/operator-controller/internal/resolution/variable_sources/entity"
14-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/required_package"
14+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/requiredpackage"
1515
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/util/predicates"
1616
entitysort "github.com/operator-framework/operator-controller/internal/resolution/variable_sources/util/sort"
1717
)
@@ -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 *required_package.RequiredPackageVariable:
77+
case *requiredpackage.RequiredPackageVariable:
7878
bundleEntityQueue = append(bundleEntityQueue, v.BundleEntities()...)
7979
}
8080
}

internal/resolution/variable_sources/bundles_and_dependencies/bundles_and_dependencies_test.go renamed to internal/resolution/variable_sources/bundlesanddependencies/bundles_and_dependencies_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package bundles_and_dependencies_test
1+
package bundlesanddependencies_test
22

33
import (
44
"context"
@@ -10,9 +10,9 @@ import (
1010
"github.com/operator-framework/deppy/pkg/deppy/input"
1111
"github.com/operator-framework/operator-registry/alpha/property"
1212

13-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
13+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundlesanddependencies"
1414
olmentity "github.com/operator-framework/operator-controller/internal/resolution/variable_sources/entity"
15-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/required_package"
15+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/requiredpackage"
1616
)
1717

1818
func TestBundlesAndDeps(t *testing.T) {
@@ -22,7 +22,7 @@ func TestBundlesAndDeps(t *testing.T) {
2222

2323
var _ = Describe("BundleVariable", func() {
2424
var (
25-
bv *bundles_and_dependencies.BundleVariable
25+
bv *bundlesanddependencies.BundleVariable
2626
bundleEntity *olmentity.BundleEntity
2727
dependencies []*olmentity.BundleEntity
2828
)
@@ -42,7 +42,7 @@ var _ = Describe("BundleVariable", func() {
4242
property.TypeChannel: `{"channelName":"stable","priority":0}`,
4343
})),
4444
}
45-
bv = bundles_and_dependencies.NewBundleVariable(bundleEntity, dependencies)
45+
bv = bundlesanddependencies.NewBundleVariable(bundleEntity, dependencies)
4646
})
4747

4848
It("should return the correct bundle entity", func() {
@@ -56,16 +56,16 @@ var _ = Describe("BundleVariable", func() {
5656

5757
var _ = Describe("BundlesAndDepsVariableSource", func() {
5858
var (
59-
bdvs *bundles_and_dependencies.BundlesAndDepsVariableSource
59+
bdvs *bundlesanddependencies.BundlesAndDepsVariableSource
6060
mockEntitySource input.EntitySource
6161
)
6262

6363
BeforeEach(func() {
64-
bdvs = bundles_and_dependencies.NewBundlesAndDepsVariableSource(
64+
bdvs = bundlesanddependencies.NewBundlesAndDepsVariableSource(
6565
&MockRequiredPackageSource{
6666
ResultSet: []deppy.Variable{
6767
// must match data in mockEntitySource
68-
required_package.NewRequiredPackageVariable("test-package", []*olmentity.BundleEntity{
68+
requiredpackage.NewRequiredPackageVariable("test-package", []*olmentity.BundleEntity{
6969
olmentity.NewBundleEntity(input.NewEntity("bundle-2", map[string]string{
7070
property.TypePackage: `{"packageName": "test-package", "version": "2.0.0"}`,
7171
property.TypeChannel: `{"channelName":"stable","priority":0}`,
@@ -83,7 +83,7 @@ var _ = Describe("BundlesAndDepsVariableSource", func() {
8383
&MockRequiredPackageSource{
8484
ResultSet: []deppy.Variable{
8585
// must match data in mockEntitySource
86-
required_package.NewRequiredPackageVariable("test-package-2", []*olmentity.BundleEntity{
86+
requiredpackage.NewRequiredPackageVariable("test-package-2", []*olmentity.BundleEntity{
8787
// test-package-2 required package - no dependencies
8888
olmentity.NewBundleEntity(input.NewEntity("bundle-15", map[string]string{
8989
property.TypePackage: `{"packageName": "test-package-2", "version": "1.5.0"}`,
@@ -192,10 +192,10 @@ var _ = Describe("BundlesAndDepsVariableSource", func() {
192192
variables, err := bdvs.GetVariables(context.TODO(), mockEntitySource)
193193
Expect(err).NotTo(HaveOccurred())
194194

195-
var bundleVariables []*bundles_and_dependencies.BundleVariable
195+
var bundleVariables []*bundlesanddependencies.BundleVariable
196196
for _, variable := range variables {
197197
switch v := variable.(type) {
198-
case *bundles_and_dependencies.BundleVariable:
198+
case *bundlesanddependencies.BundleVariable:
199199
bundleVariables = append(bundleVariables, v)
200200
}
201201
}
@@ -248,8 +248,8 @@ func (m *MockRequiredPackageSource) GetVariables(_ context.Context, _ input.Enti
248248
return m.ResultSet, nil
249249
}
250250

251-
func VariableWithID(id deppy.Identifier) func(vars []*bundles_and_dependencies.BundleVariable) *bundles_and_dependencies.BundleVariable {
252-
return func(vars []*bundles_and_dependencies.BundleVariable) *bundles_and_dependencies.BundleVariable {
251+
func VariableWithID(id deppy.Identifier) func(vars []*bundlesanddependencies.BundleVariable) *bundlesanddependencies.BundleVariable {
252+
return func(vars []*bundlesanddependencies.BundleVariable) *bundlesanddependencies.BundleVariable {
253253
for i := 0; i < len(vars); i++ {
254254
if vars[i].Identifier() == id {
255255
return vars[i]
@@ -259,7 +259,7 @@ func VariableWithID(id deppy.Identifier) func(vars []*bundles_and_dependencies.B
259259
}
260260
}
261261

262-
func CollectBundleVariableIDs(vars []*bundles_and_dependencies.BundleVariable) []string {
262+
func CollectBundleVariableIDs(vars []*bundlesanddependencies.BundleVariable) []string {
263263
ids := make([]string, 0, len(vars))
264264
for _, v := range vars {
265265
ids = append(ids, v.Identifier().String())

internal/resolution/variable_sources/crd_constraints/crd_constraints.go renamed to internal/resolution/variable_sources/crdconstraints/crd_constraints.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package crd_constraints
1+
package crdconstraints
22

33
import (
44
"context"
@@ -8,7 +8,7 @@ import (
88
"github.com/operator-framework/deppy/pkg/deppy/constraint"
99
"github.com/operator-framework/deppy/pkg/deppy/input"
1010

11-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
11+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundlesanddependencies"
1212
olmentity "github.com/operator-framework/operator-controller/internal/resolution/variable_sources/entity"
1313
)
1414

@@ -63,7 +63,7 @@ func (g *CRDUniquenessConstraintsVariableSource) GetVariables(ctx context.Contex
6363
gvkToBundleMap := map[string]map[deppy.Identifier]struct{}{}
6464
for _, variable := range variables {
6565
switch v := variable.(type) {
66-
case *bundles_and_dependencies.BundleVariable:
66+
case *bundlesanddependencies.BundleVariable:
6767
bundleEntities := []*olmentity.BundleEntity{v.BundleEntity()}
6868
bundleEntities = append(bundleEntities, v.Dependencies()...)
6969
for _, bundleEntity := range bundleEntities {

internal/resolution/variable_sources/crd_constraints/crd_constraints_test.go renamed to internal/resolution/variable_sources/crdconstraints/crd_constraints_test.go

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package crd_constraints_test
1+
package crdconstraints_test
22

33
import (
44
"context"
@@ -12,10 +12,10 @@ import (
1212
"github.com/operator-framework/deppy/pkg/deppy/input"
1313
"github.com/operator-framework/operator-registry/alpha/property"
1414

15-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
16-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/crd_constraints"
15+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundlesanddependencies"
16+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/crdconstraints"
1717
olmentity "github.com/operator-framework/operator-controller/internal/resolution/variable_sources/entity"
18-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/required_package"
18+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/requiredpackage"
1919
)
2020

2121
func TestGlobalConstraints(t *testing.T) {
@@ -27,7 +27,7 @@ var _ = Describe("BundleUniquenessVariable", func() {
2727
var (
2828
id deppy.Identifier
2929
atMostIDs []deppy.Identifier
30-
globalConstraintVariable *crd_constraints.BundleUniquenessVariable
30+
globalConstraintVariable *crdconstraints.BundleUniquenessVariable
3131
)
3232

3333
BeforeEach(func() {
@@ -36,7 +36,7 @@ var _ = Describe("BundleUniquenessVariable", func() {
3636
deppy.IdentifierFromString("test-at-most-id-1"),
3737
deppy.IdentifierFromString("test-at-most-id-2"),
3838
}
39-
globalConstraintVariable = crd_constraints.NewBundleUniquenessVariable(id, atMostIDs...)
39+
globalConstraintVariable = crdconstraints.NewBundleUniquenessVariable(id, atMostIDs...)
4040
})
4141

4242
It("should initialize a new global constraint variable", func() {
@@ -145,14 +145,14 @@ var bundleSet = map[deppy.Identifier]*input.Entity{
145145
var _ = Describe("CRDUniquenessConstraintsVariableSource", func() {
146146
var (
147147
inputVariableSource *MockInputVariableSource
148-
crdConstraintVariableSource *crd_constraints.CRDUniquenessConstraintsVariableSource
148+
crdConstraintVariableSource *crdconstraints.CRDUniquenessConstraintsVariableSource
149149
ctx context.Context
150150
entitySource input.EntitySource
151151
)
152152

153153
BeforeEach(func() {
154154
inputVariableSource = &MockInputVariableSource{}
155-
crdConstraintVariableSource = crd_constraints.NewCRDUniquenessConstraintsVariableSource(inputVariableSource)
155+
crdConstraintVariableSource = crdconstraints.NewCRDUniquenessConstraintsVariableSource(inputVariableSource)
156156
ctx = context.Background()
157157

158158
// the entity is not used in this variable source
@@ -161,16 +161,16 @@ var _ = Describe("CRDUniquenessConstraintsVariableSource", func() {
161161

162162
It("should get variables from the input variable source and create global constraint variables", func() {
163163
inputVariableSource.ResultSet = []deppy.Variable{
164-
required_package.NewRequiredPackageVariable("test-package", []*olmentity.BundleEntity{
164+
requiredpackage.NewRequiredPackageVariable("test-package", []*olmentity.BundleEntity{
165165
olmentity.NewBundleEntity(bundleSet["bundle-2"]),
166166
olmentity.NewBundleEntity(bundleSet["bundle-1"]),
167167
}),
168-
required_package.NewRequiredPackageVariable("test-package-2", []*olmentity.BundleEntity{
168+
requiredpackage.NewRequiredPackageVariable("test-package-2", []*olmentity.BundleEntity{
169169
olmentity.NewBundleEntity(bundleSet["bundle-14"]),
170170
olmentity.NewBundleEntity(bundleSet["bundle-15"]),
171171
olmentity.NewBundleEntity(bundleSet["bundle-16"]),
172172
}),
173-
bundles_and_dependencies.NewBundleVariable(
173+
bundlesanddependencies.NewBundleVariable(
174174
olmentity.NewBundleEntity(bundleSet["bundle-2"]),
175175
[]*olmentity.BundleEntity{
176176
olmentity.NewBundleEntity(bundleSet["bundle-3"]),
@@ -180,70 +180,70 @@ var _ = Describe("CRDUniquenessConstraintsVariableSource", func() {
180180
olmentity.NewBundleEntity(bundleSet["bundle-7"]),
181181
},
182182
),
183-
bundles_and_dependencies.NewBundleVariable(
183+
bundlesanddependencies.NewBundleVariable(
184184
olmentity.NewBundleEntity(bundleSet["bundle-1"]),
185185
[]*olmentity.BundleEntity{
186186
olmentity.NewBundleEntity(bundleSet["bundle-6"]),
187187
olmentity.NewBundleEntity(bundleSet["bundle-7"]),
188188
olmentity.NewBundleEntity(bundleSet["bundle-8"]),
189189
},
190190
),
191-
bundles_and_dependencies.NewBundleVariable(
191+
bundlesanddependencies.NewBundleVariable(
192192
olmentity.NewBundleEntity(bundleSet["bundle-3"]),
193193
[]*olmentity.BundleEntity{},
194194
),
195-
bundles_and_dependencies.NewBundleVariable(
195+
bundlesanddependencies.NewBundleVariable(
196196
olmentity.NewBundleEntity(bundleSet["bundle-4"]),
197197
[]*olmentity.BundleEntity{},
198198
),
199-
bundles_and_dependencies.NewBundleVariable(
199+
bundlesanddependencies.NewBundleVariable(
200200
olmentity.NewBundleEntity(bundleSet["bundle-5"]),
201201
[]*olmentity.BundleEntity{},
202202
),
203-
bundles_and_dependencies.NewBundleVariable(
203+
bundlesanddependencies.NewBundleVariable(
204204
olmentity.NewBundleEntity(bundleSet["bundle-6"]),
205205
[]*olmentity.BundleEntity{},
206206
),
207-
bundles_and_dependencies.NewBundleVariable(
207+
bundlesanddependencies.NewBundleVariable(
208208
olmentity.NewBundleEntity(bundleSet["bundle-7"]),
209209
[]*olmentity.BundleEntity{
210210
olmentity.NewBundleEntity(bundleSet["bundle-8"]),
211211
olmentity.NewBundleEntity(bundleSet["bundle-9"]),
212212
olmentity.NewBundleEntity(bundleSet["bundle-10"]),
213213
},
214214
),
215-
bundles_and_dependencies.NewBundleVariable(
215+
bundlesanddependencies.NewBundleVariable(
216216
olmentity.NewBundleEntity(bundleSet["bundle-8"]),
217217
[]*olmentity.BundleEntity{},
218218
),
219-
bundles_and_dependencies.NewBundleVariable(
219+
bundlesanddependencies.NewBundleVariable(
220220
olmentity.NewBundleEntity(bundleSet["bundle-9"]),
221221
[]*olmentity.BundleEntity{},
222222
),
223-
bundles_and_dependencies.NewBundleVariable(
223+
bundlesanddependencies.NewBundleVariable(
224224
olmentity.NewBundleEntity(bundleSet["bundle-10"]),
225225
[]*olmentity.BundleEntity{},
226226
),
227-
bundles_and_dependencies.NewBundleVariable(
227+
bundlesanddependencies.NewBundleVariable(
228228
olmentity.NewBundleEntity(bundleSet["bundle-14"]),
229229
[]*olmentity.BundleEntity{},
230230
),
231-
bundles_and_dependencies.NewBundleVariable(
231+
bundlesanddependencies.NewBundleVariable(
232232
olmentity.NewBundleEntity(bundleSet["bundle-15"]),
233233
[]*olmentity.BundleEntity{},
234234
),
235-
bundles_and_dependencies.NewBundleVariable(
235+
bundlesanddependencies.NewBundleVariable(
236236
olmentity.NewBundleEntity(bundleSet["bundle-16"]),
237237
[]*olmentity.BundleEntity{},
238238
),
239239
}
240240
variables, err := crdConstraintVariableSource.GetVariables(ctx, entitySource)
241241
Expect(err).ToNot(HaveOccurred())
242242
Expect(variables).To(HaveLen(26))
243-
var crdConstraintVariables []*crd_constraints.BundleUniquenessVariable
243+
var crdConstraintVariables []*crdconstraints.BundleUniquenessVariable
244244
for _, variable := range variables {
245245
switch v := variable.(type) {
246-
case *crd_constraints.BundleUniquenessVariable:
246+
case *crdconstraints.BundleUniquenessVariable:
247247
crdConstraintVariables = append(crdConstraintVariables, v)
248248
}
249249
}
@@ -265,7 +265,7 @@ var _ = Describe("CRDUniquenessConstraintsVariableSource", func() {
265265

266266
It("should return an error if input variable source returns an error", func() {
267267
inputVariableSource = &MockInputVariableSource{Err: fmt.Errorf("error getting variables")}
268-
crdConstraintVariableSource = crd_constraints.NewCRDUniquenessConstraintsVariableSource(inputVariableSource)
268+
crdConstraintVariableSource = crdconstraints.NewCRDUniquenessConstraintsVariableSource(inputVariableSource)
269269
_, err := crdConstraintVariableSource.GetVariables(ctx, entitySource)
270270
Expect(err).To(HaveOccurred())
271271
Expect(err.Error()).To(ContainSubstring("error getting variables"))
@@ -304,7 +304,7 @@ func (m *MockInputVariableSource) GetVariables(_ context.Context, _ input.Entity
304304
return m.ResultSet, nil
305305
}
306306

307-
func CollectGlobalConstraintVariableIDs(vars []*crd_constraints.BundleUniquenessVariable) []string {
307+
func CollectGlobalConstraintVariableIDs(vars []*crdconstraints.BundleUniquenessVariable) []string {
308308
ids := make([]string, 0, len(vars))
309309
for _, v := range vars {
310310
ids = append(ids, v.Identifier().String())

internal/resolution/variable_sources/olm/olm.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88
"sigs.k8s.io/controller-runtime/pkg/client"
99

1010
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
11-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundles_and_dependencies"
12-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/crd_constraints"
13-
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/required_package"
11+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/bundlesanddependencies"
12+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/crdconstraints"
13+
"github.com/operator-framework/operator-controller/internal/resolution/variable_sources/requiredpackage"
1414
)
1515

1616
var _ input.VariableSource = &VariableSource{}
@@ -34,10 +34,10 @@ func (o *VariableSource) GetVariables(ctx context.Context, entitySource input.En
3434
// build required package variable sources
3535
inputVariableSources := make([]input.VariableSource, 0, len(operatorList.Items))
3636
for _, operator := range operatorList.Items {
37-
rps, err := required_package.NewRequiredPackage(
37+
rps, err := requiredpackage.NewRequiredPackage(
3838
operator.Spec.PackageName,
39-
required_package.InVersionRange(operator.Spec.Version),
40-
required_package.InChannel(operator.Spec.Channel),
39+
requiredpackage.InVersionRange(operator.Spec.Version),
40+
requiredpackage.InChannel(operator.Spec.Channel),
4141
)
4242
if err != nil {
4343
return nil, err
@@ -46,6 +46,6 @@ func (o *VariableSource) GetVariables(ctx context.Context, entitySource input.En
4646
}
4747

4848
// build variable source pipeline
49-
variableSource := crd_constraints.NewCRDUniquenessConstraintsVariableSource(bundles_and_dependencies.NewBundlesAndDepsVariableSource(inputVariableSources...))
49+
variableSource := crdconstraints.NewCRDUniquenessConstraintsVariableSource(bundlesanddependencies.NewBundlesAndDepsVariableSource(inputVariableSources...))
5050
return variableSource.GetVariables(ctx, entitySource)
5151
}

0 commit comments

Comments
 (0)