From 430bec5225753c29f2fe594920f68442c73ddea6 Mon Sep 17 00:00:00 2001 From: bussyjd Date: Thu, 23 Apr 2026 04:23:29 +0800 Subject: [PATCH] fix(serviceoffer): drop orphan shared-registration tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #364's squash merge left two tests in controller_test.go referencing `applySharedRegistrationStatus`, a function that was not carried over into `controller.go`. Result: `go test ./internal/serviceoffercontroller/` has been failing to build on main ever since with: controller_test.go:119:2: undefined: applySharedRegistrationStatus controller_test.go:139:2: undefined: applySharedRegistrationStatus Those tests describe a "shared registration across ServiceOffers" design that is not the behavior currently implemented — reconcileRegistrationStatus at controller.go:568 deliberately returns SingletonConflict for non-owner offers. Restoring the function alone would leave it dead; wiring it in would silently revert the singleton direction. Neither is in scope here. This patch removes the two orphan tests to restore the build. If the shared-registration feature is desired, a proper PR should land both the function and its caller in reconcileRegistrationStatus. --- .../serviceoffercontroller/controller_test.go | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/internal/serviceoffercontroller/controller_test.go b/internal/serviceoffercontroller/controller_test.go index 8d308b0b9..afbddb5a6 100644 --- a/internal/serviceoffercontroller/controller_test.go +++ b/internal/serviceoffercontroller/controller_test.go @@ -101,44 +101,3 @@ func TestPurchaseReadyRequiresRuntimePoolToMatchSpec(t *testing.T) { t.Fatal("purchase should be ready once runtime pool matches spec") } } - -func TestApplySharedRegistrationStatus_NonOwnerUsesSharedAgent(t *testing.T) { - status := &monetizeapi.ServiceOfferStatus{ - Conditions: []monetizeapi.Condition{{Type: "RoutePublished", Status: "True"}}, - } - owner := &monetizeapi.ServiceOffer{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Namespace: "demo"}} - offer := &monetizeapi.ServiceOffer{ObjectMeta: metav1.ObjectMeta{Name: "beta", Namespace: "demo"}} - request := &monetizeapi.RegistrationRequest{ - Status: monetizeapi.RegistrationRequestStatus{ - Phase: registrationPhaseRegistered, - AgentID: "42", - RegistrationTxHash: "0xtx", - }, - } - - applySharedRegistrationStatus(status, offer, owner, request) - - if status.AgentID != "42" || status.RegistrationTxHash != "0xtx" { - t.Fatalf("shared registration identifiers not copied: %+v", status) - } - if !isConditionTrue(*status, "Registered") { - t.Fatalf("registered condition not set true: %+v", status.Conditions) - } -} - -func TestApplySharedRegistrationStatus_WaitsForRoute(t *testing.T) { - status := &monetizeapi.ServiceOfferStatus{} - owner := &monetizeapi.ServiceOffer{ObjectMeta: metav1.ObjectMeta{Name: "alpha", Namespace: "demo"}} - request := &monetizeapi.RegistrationRequest{ - Status: monetizeapi.RegistrationRequestStatus{ - Phase: registrationPhaseRegistered, - AgentID: "7", - }, - } - - applySharedRegistrationStatus(status, owner, owner, request) - - if isConditionTrue(*status, "Registered") { - t.Fatalf("registered should remain false until route is published: %+v", status.Conditions) - } -}