Skip to content

Commit d46f37b

Browse files
david-yuclaude
andcommitted
fix: pre-create topic in produce acceptance test and harden controller
The Pipeline_produces_to_Redpanda_via_clusterRef acceptance test failed consistently because Redpanda defaults auto_create_topics_enabled to false. The producer pipeline could not auto-create the target topic, so no messages were ever delivered. - Pre-create pipeline-produce-test topic before running the producer pipeline, matching the pattern used by the consumer scenario - Remove misleading "Found topic" logs from ExpectTopic/ExpectNoTopic that printed unconditionally even when the topic was not found - Increase checkTopic timeout from 10s to 30s for CI stability - Handle NotFound/Conflict errors during finalizer removal to avoid noisy UID precondition errors when pipelines are deleted concurrently Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 026d073 commit d46f37b

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

acceptance/features/pipeline-crds.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ Feature: Pipeline CRDs
200200
Then pipeline "invalid-pipeline" has invalid config
201201

202202
Scenario: Pipeline produces to Redpanda via clusterRef
203+
Given I create topic "pipeline-produce-test" in cluster "basic"
203204
When I apply Kubernetes manifest:
204205
"""
205206
---

acceptance/steps/helpers.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,13 @@ func (c *clusterClients) ExpectTopic(ctx context.Context, topic string) {
252252

253253
t.Logf("Checking that topic %q exists in cluster %q", topic, c.cluster)
254254
c.checkTopic(ctx, topic, true, fmt.Sprintf("Topic %q does not exist in cluster %q", topic, c.cluster))
255-
t.Logf("Found topic %q in cluster %q", topic, c.cluster)
256255
}
257256

258257
func (c *clusterClients) ExpectNoTopic(ctx context.Context, topic string) {
259258
t := framework.T(ctx)
260259

261260
t.Logf("Checking that topic %q does not exist in cluster %q", topic, c.cluster)
262261
c.checkTopic(ctx, topic, false, fmt.Sprintf("Topic %q still exists in cluster %q", topic, c.cluster))
263-
t.Logf("Found no topic %q in cluster %q", topic, c.cluster)
264262
}
265263

266264
// Enable experimental feature support.
@@ -314,7 +312,7 @@ func (c *clusterClients) checkTopic(ctx context.Context, topic string, exists bo
314312
require.NoError(t, topics.Error())
315313

316314
return exists == topics.Has(topic)
317-
}, 10*time.Second, 1*time.Second, message) {
315+
}, 30*time.Second, 2*time.Second, message) {
318316
t.Errorf("Final list of topics: %v", topics.Names())
319317
}
320318
}

operator/internal/controller/pipeline/controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ func (c *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
152152
}
153153
// NB: Apply can't be used to remove finalizers.
154154
if err := c.Ctl.Update(ctx, pipeline); err != nil {
155+
// The object may have been fully deleted between Get and
156+
// Update. This is benign — the finalizer is already gone.
157+
if apierrors.IsNotFound(err) || apierrors.IsConflict(err) {
158+
return ctrl.Result{}, nil
159+
}
155160
return ctrl.Result{}, err
156161
}
157162
}

0 commit comments

Comments
 (0)