@@ -3,13 +3,9 @@ package controllers_test
3
3
import (
4
4
"context"
5
5
"fmt"
6
- "strings"
7
- "time"
8
6
9
- "github.com/go-logr/logr/funcr"
10
7
. "github.com/onsi/ginkgo/v2"
11
8
. "github.com/onsi/gomega"
12
- catalogd "github.com/operator-framework/catalogd/api/core/v1alpha1"
13
9
"github.com/operator-framework/deppy/pkg/deppy"
14
10
"github.com/operator-framework/deppy/pkg/deppy/input"
15
11
"github.com/operator-framework/deppy/pkg/deppy/solver"
@@ -22,7 +18,6 @@ import (
22
18
ctrl "sigs.k8s.io/controller-runtime"
23
19
"sigs.k8s.io/controller-runtime/pkg/client"
24
20
"sigs.k8s.io/controller-runtime/pkg/client/fake"
25
- "sigs.k8s.io/controller-runtime/pkg/log"
26
21
27
22
operatorsv1alpha1 "github.com/operator-framework/operator-controller/api/v1alpha1"
28
23
"github.com/operator-framework/operator-controller/internal/conditionsets"
@@ -1062,94 +1057,6 @@ var _ = Describe("Operator Controller Test", func() {
1062
1057
})
1063
1058
})
1064
1059
})
1065
- When ("a catalog changes on cluster" , func () {
1066
- var testLogs , opNames []string
1067
- var cancel context.CancelFunc
1068
- var logCount int
1069
- BeforeEach (func () {
1070
- l := funcr .New (func (prefix , args string ) {
1071
- if prefix == "operator-controller" &&
1072
- strings .Contains (args , `"controller"="operator"` ) &&
1073
- strings .Contains (args , `"msg"="ending"` ) {
1074
- // filter for only relevant logs
1075
- testLogs = append (testLogs , fmt .Sprintf ("%s" , args ))
1076
- }
1077
- }, funcr.Options {Verbosity : 1 })
1078
- mgr , err := ctrl .NewManager (cfg , ctrl.Options {Scheme : sch , Logger : l })
1079
- Expect (err ).To (BeNil ())
1080
-
1081
- err = reconciler .SetupWithManager (mgr )
1082
- Expect (err ).To (BeNil ())
1083
- var mgrCtx context.Context
1084
- mgrCtx , cancel = context .WithCancel (log .IntoContext (ctx , l ))
1085
-
1086
- go func () {
1087
- err := mgr .Start (mgrCtx )
1088
- Expect (err ).To (BeNil ())
1089
- }()
1090
-
1091
- opNames = []string {"prometheus" , "project-quay" }
1092
- for _ , p := range opNames {
1093
- op := & operatorsv1alpha1.Operator {ObjectMeta : metav1.ObjectMeta {Name : p }, Spec : operatorsv1alpha1.OperatorSpec {PackageName : p }}
1094
- err := cl .Create (ctx , op )
1095
- Expect (err ).To (BeNil ())
1096
- }
1097
- Eventually (func (g Gomega ) {
1098
- By ("verifying initial reconcile logs for operator creation" )
1099
- g .Expect (len (testLogs ) >= len (opNames )).To (BeTrue ())
1100
- for _ , p := range opNames {
1101
- g .Expect (testLogs [len (testLogs )- len (opNames ):]).To (ContainElement (ContainSubstring (fmt .Sprintf ("\" Operator\" ={\" name\" :\" %s\" }" , p ))))
1102
- }
1103
- logCount = len (testLogs )
1104
- }).WithTimeout (2 * time .Second ).WithPolling (1 * time .Second ).Should (Succeed ())
1105
- })
1106
-
1107
- It ("reconciles all affected operators on cluster" , func () {
1108
- By ("creating a new catalog" )
1109
- catalog := & catalogd.Catalog {ObjectMeta : metav1.ObjectMeta {Name : "t" }, Spec : catalogd.CatalogSpec {Source : catalogd.CatalogSource {Type : catalogd .SourceTypeImage , Image : & catalogd.ImageSource {}}}}
1110
- err := cl .Create (ctx , catalog )
1111
- Expect (err ).To (BeNil ())
1112
- Eventually (func (g Gomega ) {
1113
- By ("verifying operator reconcile logs on catalog create" )
1114
- g .Expect (testLogs ).To (HaveLen (logCount + len (opNames )))
1115
- for _ , p := range opNames {
1116
- g .Expect (testLogs [len (testLogs )- len (opNames ):]).To (ContainElement (ContainSubstring (fmt .Sprintf ("\" Operator\" ={\" name\" :\" %s\" }" , p ))))
1117
- }
1118
- logCount = len (testLogs )
1119
- }).WithTimeout (2 * time .Second ).WithPolling (1 * time .Second ).Should (Succeed ())
1120
-
1121
- By ("updating a catalog" )
1122
- catalog .Spec .Source .Image .Ref = "s"
1123
- err = cl .Update (ctx , catalog )
1124
- Expect (err ).To (BeNil ())
1125
- Eventually (func (g Gomega ) {
1126
- By ("verifying operator reconcile logs on catalog update" )
1127
- g .Expect (testLogs ).To (HaveLen (logCount + len (opNames )))
1128
- for _ , p := range opNames {
1129
- g .Expect (testLogs [len (testLogs )- len (opNames ):]).To (ContainElement (ContainSubstring (fmt .Sprintf ("\" Operator\" ={\" name\" :\" %s\" }" , p ))))
1130
- }
1131
- logCount = len (testLogs )
1132
- }).WithTimeout (2 * time .Second ).WithPolling (1 * time .Second ).Should (Succeed ())
1133
-
1134
- By ("deleting a catalog" )
1135
- err = cl .Delete (ctx , catalog )
1136
- Expect (err ).To (BeNil ())
1137
- Eventually (func (g Gomega ) {
1138
- By ("verifying operator reconcile logs on catalog delete" )
1139
- g .Expect (testLogs ).To (HaveLen (logCount + len (opNames )))
1140
- for _ , p := range opNames {
1141
- g .Expect (testLogs [len (testLogs )- len (opNames ):]).To (ContainElement (ContainSubstring (fmt .Sprintf ("\" Operator\" ={\" name\" :\" %s\" }" , p ))))
1142
- }
1143
- }).WithTimeout (2 * time .Second ).WithPolling (1 * time .Second ).Should (Succeed ())
1144
- })
1145
- AfterEach (func () {
1146
- for _ , p := range opNames {
1147
- op := & operatorsv1alpha1.Operator {ObjectMeta : metav1.ObjectMeta {Name : p }, Spec : operatorsv1alpha1.OperatorSpec {PackageName : p }}
1148
- Expect (cl .Delete (ctx , op )).To (BeNil ())
1149
- }
1150
- cancel () // stop manager
1151
- })
1152
- })
1153
1060
})
1154
1061
1155
1062
func verifyInvariants (ctx context.Context , c client.Client , op * operatorsv1alpha1.Operator ) {
@@ -1188,12 +1095,6 @@ var testEntitySource = input.NewCacheQuerier(map[deppy.Identifier]input.Entity{
1188
1095
"olm.package" : `{"packageName":"prometheus","version":"0.47.0"}` ,
1189
1096
"olm.gvk" : `[]` ,
1190
1097
}),
1191
- "operatorhub/project-quay/3.8.3" : * input .NewEntity ("operatorhub/project-quay/3.8.3" , map [string ]string {
1192
- "olm.bundle.path" : `"quay.io/openshift-community-operators/project-quay@sha256:4f5698b5fec2e5f9a4df78b5ef9609b3a697c81cdb137b98e82e79104f0eb3b5"` ,
1193
- "olm.channel" : `{"channelName":"stable","priority":0}` ,
1194
- "olm.package" : `{"packageName":"project-quay","version":"3.8.3"}` ,
1195
- "olm.gvk" : `[]` ,
1196
- }),
1197
1098
"operatorhub/badimage/0.1.0" : * input .NewEntity ("operatorhub/badimage/0.1.0" , map [string ]string {
1198
1099
"olm.bundle.path" : `{"name": "quay.io/operatorhubio/badimage:v0.1.0"}` ,
1199
1100
"olm.package" : `{"packageName":"badimage","version":"0.1.0"}` ,
0 commit comments