Skip to content

Commit b3c1ea4

Browse files
david-yuclaude
andcommitted
fix: address CI test and lint failures
- Set spec.cluster.clusterRef.name on test CRs so they pass CRD validation (Topic/User require cluster or kafkaApiSpec) - Remove trailing blank line in resource_controller_test.go that caused git diff --exit-code lint failure Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d2751c7 commit b3c1ea4

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

operator/cmd/finalizerremoval/finalizer_removal_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ func TestRemoveFinalizersForGVK(t *testing.T) {
6969
obj.SetGroupVersionKind(gvk)
7070
obj.SetName(name)
7171
obj.SetNamespace(ns)
72-
// Set required spec field so the API server accepts the object.
73-
_ = unstructured.SetNestedMap(obj.Object, map[string]interface{}{}, "spec")
72+
// CRDs require spec.cluster.clusterRef to pass validation.
73+
_ = unstructured.SetNestedField(obj.Object, "dummy", "spec", "cluster", "clusterRef", "name")
7474
require.NoError(t, k8sClient.Create(ctx, obj))
7575
// Add finalizer via patch after creation.
7676
patch := client.MergeFrom(obj.DeepCopy())
@@ -116,7 +116,7 @@ func TestRemoveFinalizersForGVK(t *testing.T) {
116116
obj.SetGroupVersionKind(gvk)
117117
obj.SetName("no-finalizer-topic")
118118
obj.SetNamespace("default")
119-
_ = unstructured.SetNestedMap(obj.Object, map[string]interface{}{}, "spec")
119+
_ = unstructured.SetNestedField(obj.Object, "dummy", "spec", "cluster", "clusterRef", "name")
120120
require.NoError(t, k8sClient.Create(ctx, obj))
121121

122122
require.NoError(t, removeFinalizersForGVK(ctx, k8sClient, gvk))

operator/internal/controller/redpanda/resource_controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ func TestResourceController(t *testing.T) { // nolint:funlen // These tests have
607607

608608
require.Equal(t, int32(size/2), reconciler.deletes.Load())
609609
require.Equal(t, int32(size), reconciler.syncs.Load())
610-
611610
}
612611

613612
func TestIsNetworkDialError(t *testing.T) {

0 commit comments

Comments
 (0)