Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion providers/azure/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch v1.4.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql v1.2.0
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261020191912-205cf99b8ef3
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261026065151-8e125008e26c
github.com/stretchr/testify v1.11.1
golang.org/x/sync v0.23.0
)
Expand Down
4 changes: 2 additions & 2 deletions providers/azure/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJ
github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE=
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0 h1:XRzhVemXdgvJqCH0sFfrBUTnUJSBrBf7++ypk+twtRs=
github.com/AzureAD/microsoft-authentication-library-for-go v1.6.0/go.mod h1:HKpQxkWaGLJ+D/5H8QRpyQXA1eKjxkFlOMwck5+33Jk=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261020191912-205cf99b8ef3 h1:NBjYpYKzw1mRs77nRaCya+HcuJdV6SaPCJEbJVbza0U=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261020191912-205cf99b8ef3/go.mod h1:awNjqN4KJHvFvb2wzKWrwXK954pkHtevPl0TtYkS2io=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261026065151-8e125008e26c h1:YXlwqzUalFu+lQ3eQ0rtbUvcwM13TUsmUMZ5ChpFF18=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261026065151-8e125008e26c/go.mod h1:rEJErEsL40Np/ttf0RDoNNC2XQsN1GmWyFf34y0JLD8=
github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY=
github.com/aws/aws-sdk-go-v2 v1.41.5/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o=
github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng=
Expand Down
16 changes: 5 additions & 11 deletions providers/azure/services/savingsplans/scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,12 @@ type coveringLister interface {

var _ coveringLister = (*Client)(nil)

// coveringView hands DuplicateChecker the covering list as its inventory, so
// this test exercises the recfilter matching against the pinned pkg as well as
// the workspace one, which picks GetCoveringCommitments up on its own.
type coveringView struct{ *Client }

func (v coveringView) GetExistingCommitments(ctx context.Context) ([]common.Commitment, error) {
return v.GetCoveringCommitments(ctx)
}

// A plan billed to sub-b and bought an hour ago, decoded by the real SDK pager
// (#466): only sub-b owns it, but it suppresses sub-a's matching recommendation
// unless its Single scope names another subscription.
// unless its Single scope names another subscription. DuplicateChecker gets the
// real Client, so it must find GetCoveringCommitments on its own; that only
// holds when go.mod pins a pkg with the covering selector (#491), which a
// standalone (GOWORK=off) run checks.
func TestDuplicateChecker_PlanBilledToAnotherSubscription(t *testing.T) {
row := func(applied, props string) string {
return fmt.Sprintf(`{"id":"p1","name":"Compute","sku":{"name":"Compute_Savings_Plan"},"properties":{"billingScopeId":"/subscriptions/sub-b","appliedScopeType":%q,"appliedScopeProperties":%s,"provisioningState":"Succeeded","effectiveDateTime":%q}}`,
Expand Down Expand Up @@ -310,7 +304,7 @@ func TestDuplicateChecker_PlanBilledToAnotherSubscription(t *testing.T) {
assert.Equal(t, "sub-b", ownedB[0].Account)

recs := []common.Recommendation{{Provider: common.ProviderAzure, Service: common.ServiceSavingsPlansAll, ResourceType: "Compute", Count: 1}}
passed, filtered, err := recfilter.NewDuplicateChecker(24).AdjustRecommendationsForExisting(context.Background(), recs, coveringView{client("sub-a")})
passed, filtered, err := recfilter.NewDuplicateChecker(24).AdjustRecommendationsForExisting(context.Background(), recs, client("sub-a"))
require.NoError(t, err)
if tt.wantSuppress {
assert.Empty(t, passed)
Expand Down
Loading