Skip to content

Commit

Permalink
Loosen up Owner-Child resource subscription checks (#4343)
Browse files Browse the repository at this point in the history
* Loosen up Owner-Child resource subscription checks

* Update test cases

* Add back the nestedResource check

* modify test to use kuberef

* update test name; add comment

* format code
  • Loading branch information
super-harsh authored Dec 3, 2024
1 parent 8850de9 commit 79d125c
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 157 deletions.
5 changes: 1 addition & 4 deletions v2/internal/controllers/owner_arm_id_negative_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func Test_OwnerIsARMIDOfWrongType_Rejected(t *testing.T) {
tc.Expect(err).To(MatchError(ContainSubstring("expected owner ARM ID to be for a resource group, but was \"Microsoft.Compute/virtualMachines\"")))
}

func Test_OwnerIsARMIDFromDifferentSubscription_ResourceFails(t *testing.T) {
func Test_OwnerIsKubernetesResourceFromDifferentSubscription_ResourceFails(t *testing.T) {
t.Parallel()
tc := globalTestContext.ForTest(t)

Expand All @@ -63,15 +63,12 @@ func Test_OwnerIsARMIDFromDifferentSubscription_ResourceFails(t *testing.T) {
// Create a resource group
rg := tc.CreateTestResourceGroupAndWait()

// Get the rg's ARM ID
tc.Expect(rg.Status.Id).ToNot(BeNil())
armID := *rg.Status.Id

scopedCredentialName := "other-subscription-secret"

// Now create a storage account
acct := newStorageAccount20230101(tc, rg)
acct.Spec.Owner = testcommon.AsARMIDOwner(armID)
acct.Annotations = map[string]string{annotations.PerResourceSecret: scopedCredentialName}

uuid, err := tc.Namer.GenerateUUID()
Expand Down

This file was deleted.

Loading

0 comments on commit 79d125c

Please sign in to comment.