Skip to content

Commit c92c8fc

Browse files
committed
Fix e2e catalogsource image
Signed-off-by: Ankita Thomas <[email protected]>
1 parent 18dbd16 commit c92c8fc

File tree

3 files changed

+7
-32
lines changed

3 files changed

+7
-32
lines changed

controllers/catalogsource_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ func (r *CatalogSourceReconciler) Reconcile(ctx context.Context, req ctrl.Reques
102102
}
103103

104104
entities, err := r.registry.ListEntities(ctx, catalogSource)
105+
// TODO: invalidate stale cache for failed updates
105106
if err != nil {
106107
r.recorder.Event(catalogSource, eventTypeWarning, eventReasonCacheUpdateFailed, fmt.Sprintf("Failed to update bundle cache from %s/%s: %v", catalogSource.GetNamespace(), catalogSource.GetName(), err))
107108
return ctrl.Result{Requeue: !isManagedCatalogSource(*catalogSource)}, err

test/e2e/catalogsource_install_test.go

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func createTestRegistryPod(ctx context.Context, cli client.Client, namespace, pr
7575
Containers: []corev1.Container{{
7676
Name: "registry",
7777
// TODO: switch to using locally built and loaded images to avoid flakes
78-
Image: "quay.io/ankitathomas/index:prometheus-index-v0.37.0",
78+
Image: "quay.io/ankitathomas/index:quay",
7979
Ports: []corev1.ContainerPort{
8080
{
8181
Name: "grpc",
@@ -155,32 +155,6 @@ func createTestRegistryService(ctx context.Context, cli client.Client, namespace
155155
err := c.Create(ctx, svc)
156156
Expect(err).To(BeNil())
157157

158-
// svcAddress := getServiceAddress(ctx, cli, namespace, svc.Name)
159-
160-
// conn, err := grpc.Dial(svcAddress, grpc.WithInsecure())
161-
// Expect(err).ToNot(HaveOccurred())
162-
163-
// fmt.Println("svcAddress", svcAddress)
164-
// connectionContext, cancel := context.WithTimeout(context.Background(), 30*time.Second)
165-
// defer cancel()
166-
167-
// defer conn.Close()
168-
// oldState := conn.GetState()
169-
// Eventually(func(g Gomega) {
170-
// state := conn.GetState()
171-
// if state != connectivity.Ready {
172-
// if conn.WaitForStateChange(connectionContext, conn.GetState()) {
173-
// state = conn.GetState()
174-
// if oldState != state {
175-
// oldState = state
176-
// if state == connectivity.Idle {
177-
// conn.Connect()
178-
// }
179-
// }
180-
// }
181-
// }
182-
// g.Expect(conn.GetState()).To(Equal(connectivity.Ready))
183-
// }).WithTimeout(2 * time.Minute).Should(Succeed())
184158
return svc.Name
185159
}
186160

@@ -191,6 +165,7 @@ func getServiceAddress(ctx context.Context, cli client.Client, namespace, name s
191165
return fmt.Sprintf("%s.%s.svc:%d", svc.Name, svc.Namespace, svc.Spec.Ports[0].Port)
192166
}
193167

168+
// TODO: ensure CRD support in test environment setup in Makefile
194169
func applyCRDifNotPresent(ctx context.Context) func() {
195170
cleanup := func() {}
196171
scheme := runtime.NewScheme()
@@ -245,7 +220,8 @@ func createTestCatalogSource(ctx context.Context, cli client.Client, namespace,
245220
Namespace: namespace,
246221
},
247222
Spec: v1alpha1.CatalogSourceSpec{
248-
Address: getServiceAddress(ctx, cli, namespace, serviceName),
223+
Address: getServiceAddress(ctx, cli, namespace, serviceName),
224+
SourceType: v1alpha1.SourceTypeGrpc,
249225
},
250226
})
251227
Expect(err).To(BeNil())

test/e2e/install_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var _ = Describe("Operator Install", func() {
3232
cleanup := func() {}
3333
ctx = context.TODO()
3434
BeforeEach(func() {
35-
testNamespace := createTestNamespace(ctx, c, "registry-grpc-")
35+
testNamespace = createTestNamespace(ctx, c, "registry-grpc-")
3636
cleanup = applyCRDifNotPresent(ctx)
3737
testPrefix := "registry-grpc-"
3838

@@ -48,7 +48,7 @@ var _ = Describe("Operator Install", func() {
4848
})
4949
It("resolves the specified package with correct bundle path", func() {
5050
ctx = context.Background()
51-
pkgName = "prometheus"
51+
pkgName = "project-quay"
5252
operatorName = fmt.Sprintf("operator-%s", rand.String(8))
5353
operator = &operatorv1alpha1.Operator{
5454
ObjectMeta: metav1.ObjectMeta{
@@ -63,8 +63,6 @@ var _ = Describe("Operator Install", func() {
6363
err := c.Create(ctx, operator)
6464
Expect(err).ToNot(HaveOccurred())
6565

66-
// TODO dfranz: This test currently relies on the hard-coded CatalogSources found in bundle_cache.go
67-
// and should be re-worked to use a real or test catalog source when the hard-coded stuff is removed
6866
By("eventually reporting a successful resolution and bundle path")
6967
Eventually(func(g Gomega) {
7068
err = c.Get(ctx, types.NamespacedName{Name: operator.Name}, operator)

0 commit comments

Comments
 (0)