Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ukff committed Sep 25, 2024
1 parent d519ddf commit 4eaa0a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 5 additions & 7 deletions internal/broker/instance_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,12 @@ func (b *UpdateEndpoint) processContext(instance *internal.Instance, details dom
}

needUpdateCustomResources := false
if b.subaccountMovementEnabled {
if instance.GlobalAccountID != ersContext.GlobalAccountID && ersContext.GlobalAccountID != "" {
if instance.SubscriptionGlobalAccountID == "" {
instance.SubscriptionGlobalAccountID = instance.GlobalAccountID
}
instance.GlobalAccountID = ersContext.GlobalAccountID
needUpdateCustomResources = true
if b.subaccountMovementEnabled && (instance.GlobalAccountID != ersContext.GlobalAccountID && ersContext.GlobalAccountID != "") {
if instance.SubscriptionGlobalAccountID == "" {
instance.SubscriptionGlobalAccountID = instance.GlobalAccountID
}
instance.GlobalAccountID = ersContext.GlobalAccountID
needUpdateCustomResources = true
}

newInstance, err := b.instanceStorage.Update(*instance)
Expand Down
5 changes: 2 additions & 3 deletions internal/broker/instance_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ func TestUpdateEndpoint_UpdateWithEnabledDashboard(t *testing.T) {
st := storage.NewMemoryStorage()
err := st.Instances().Insert(instance)
require.NoError(t, err)
createFakeCRs(t)
err = st.Operations().InsertProvisioningOperation(fixProvisioningOperation("01"))
require.NoError(t, err)
// st.Operations().InsertDeprovisioningOperation(fixSuspensionOperation())
Expand All @@ -620,7 +621,6 @@ func TestUpdateEndpoint_UpdateWithEnabledDashboard(t *testing.T) {
kcBuilder := &kcMock.KcBuilder{}
svc := NewUpdate(Config{AllowUpdateExpiredInstanceWithContext: true}, st.Instances(), st.RuntimeStates(), st.Operations(), handler, true, false, true, q, PlansConfig{},
planDefaults, logrus.New(), dashboardConfig, kcBuilder, &OneForAllConvergedCloudRegionsProvider{}, fakeKcpK8sClient)
createFakeCRs(t)
// when
response, err := svc.Update(context.Background(), instanceID, domain.UpdateDetails{
ServiceID: "",
Expand Down Expand Up @@ -738,9 +738,8 @@ func TestSubaccountMovement(t *testing.T) {
},
}

createFakeCRs(t)

storage := storage.NewMemoryStorage()
createFakeCRs(t)
err := storage.Instances().Insert(instance)
require.NoError(t, err)

Expand Down

0 comments on commit 4eaa0a6

Please sign in to comment.