Skip to content

Commit

Permalink
Removes util package
Browse files Browse the repository at this point in the history
`util` is too generic for a package name.
  • Loading branch information
m1kola committed May 19, 2023
1 parent 6700914 commit 788b6a5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions api/v1alpha1/operator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

operatorutil "github.com/operator-framework/operator-controller/internal/util"
"github.com/operator-framework/operator-controller/internal/conditionsets"
)

// OperatorSpec defines the desired state of Operator
Expand Down Expand Up @@ -61,12 +61,12 @@ const (

func init() {
// TODO(user): add Types from above
operatorutil.ConditionTypes = append(operatorutil.ConditionTypes,
conditionsets.ConditionTypes = append(conditionsets.ConditionTypes,
TypeReady,
TypeResolved,
)
// TODO(user): add Reasons from above
operatorutil.ConditionReasons = append(operatorutil.ConditionReasons,
conditionsets.ConditionReasons = append(conditionsets.ConditionReasons,
ReasonInstallationSucceeded,
ReasonResolutionFailed,
ReasonResolutionUnknown,
Expand Down
10 changes: 5 additions & 5 deletions api/v1alpha1/operator_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

operatorutil "github.com/operator-framework/operator-controller/internal/util"
"github.com/operator-framework/operator-controller/internal/conditionsets"
)

var _ = Describe("OperatorTypes", func() {
Expand All @@ -22,9 +22,9 @@ var _ = Describe("OperatorTypes", func() {
Expect(err).NotTo(HaveOccurred())

for _, t := range types {
Expect(t).To(BeElementOf(operatorutil.ConditionTypes), "Append Type%s to operatorutil.ConditionTypes in this package's init function.", t)
Expect(t).To(BeElementOf(conditionsets.ConditionTypes), "Append Type%s to operatorutil.ConditionTypes in this package's init function.", t)
}
for _, t := range operatorutil.ConditionTypes {
for _, t := range conditionsets.ConditionTypes {
Expect(t).To(BeElementOf(types), "There must be a Type%[1]s string literal constant for type %[1]q (i.e. 'const Type%[1]s = %[1]q')", t)
}
})
Expand All @@ -33,9 +33,9 @@ var _ = Describe("OperatorTypes", func() {
Expect(err).NotTo(HaveOccurred())

for _, r := range reasons {
Expect(r).To(BeElementOf(operatorutil.ConditionReasons), "Append Reason%s to operatorutil.ConditionReasons in this package's init function.", r)
Expect(r).To(BeElementOf(conditionsets.ConditionReasons), "Append Reason%s to operatorutil.ConditionReasons in this package's init function.", r)
}
for _, r := range operatorutil.ConditionReasons {
for _, r := range conditionsets.ConditionReasons {
Expect(r).To(BeElementOf(reasons), "There must be a Reason%[1]s string literal constant for reason %[1]q (i.e. 'const Reason%[1]s = %[1]q')", r)
}
})
Expand Down
8 changes: 4 additions & 4 deletions controllers/operator_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (

operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
"github.com/operator-framework/operator-controller/controllers"
"github.com/operator-framework/operator-controller/internal/conditionsets"
"github.com/operator-framework/operator-controller/internal/resolution"
operatorutil "github.com/operator-framework/operator-controller/internal/util"
)

var _ = Describe("Operator Controller Test", func() {
Expand Down Expand Up @@ -1015,12 +1015,12 @@ func verifyConditionsInvariants(op *operatorsv1alpha1.Operator) {
// condition types for the Operator API. Every reconcile should always
// ensure every condition type's status/reason/message reflects the state
// read during _this_ reconcile call.
Expect(op.Status.Conditions).To(HaveLen(len(operatorutil.ConditionTypes)))
for _, t := range operatorutil.ConditionTypes {
Expect(op.Status.Conditions).To(HaveLen(len(conditionsets.ConditionTypes)))
for _, t := range conditionsets.ConditionTypes {
cond := apimeta.FindStatusCondition(op.Status.Conditions, t)
Expect(cond).To(Not(BeNil()))
Expect(cond.Status).NotTo(BeEmpty())
Expect(cond.Reason).To(BeElementOf(operatorutil.ConditionReasons))
Expect(cond.Reason).To(BeElementOf(conditionsets.ConditionReasons))
Expect(cond.ObservedGeneration).To(Equal(op.GetGeneration()))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package util
package conditionsets

// ConditionTypes is the full set of Operator condition Types.
// ConditionReasons is the full set of Operator condition Reasons.
Expand Down

0 comments on commit 788b6a5

Please sign in to comment.