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/aws/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/LeanerCloud/cloud-commitments-go/providers/aws
go 1.26.10

require (
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261108091534-a52dfb9143cc
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261109130250-81a709068bba
github.com/aws/aws-sdk-go-v2 v1.47.5
github.com/aws/aws-sdk-go-v2/config v1.33.13
github.com/aws/aws-sdk-go-v2/credentials v1.20.13
Expand Down
4 changes: 2 additions & 2 deletions providers/aws/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261108091534-a52dfb9143cc h1:4Aw4TpF9X1Jw/eCQTvBp3bHmFhS8GIWdl5L48d6v3Zs=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261108091534-a52dfb9143cc/go.mod h1:l9V+ecJCfAigYr6XiK9kpIUemF9bnXOKHJN1s4TPsM0=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261109130250-81a709068bba h1:UmAWblM7ikU36NJ/aUq09HnHrXPQpNpe3WA0zQZEV2k=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261109130250-81a709068bba/go.mod h1:l9V+ecJCfAigYr6XiK9kpIUemF9bnXOKHJN1s4TPsM0=
github.com/aws/aws-sdk-go-v2 v1.47.5 h1:5yA+A+BiXbDq1ZLbYwPViwhEGDMdR0MEhL8Jh2LnLS4=
github.com/aws/aws-sdk-go-v2 v1.47.5/go.mod h1:iNIkogrRvFwm+1OQIUOP2lPBtlXZboOIUWiCa+pHEMw=
github.com/aws/aws-sdk-go-v2/config v1.33.13 h1:u52x6ISQOx172tpwM0VRxhJzEsTJYpMcEYUGM2A1wrw=
Expand Down
6 changes: 3 additions & 3 deletions providers/azure/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ 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-20261104063122-3efa339480ac
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261109130250-81a709068bba
github.com/stretchr/testify v1.12.1
golang.org/x/sync v0.24.0
)

require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.13.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 // indirect
github.com/aws/aws-sdk-go-v2 v1.47.4 // indirect
github.com/aws/smithy-go v1.28.6 // indirect
github.com/aws/aws-sdk-go-v2 v1.47.5 // indirect
github.com/aws/smithy-go v1.28.7 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions providers/azure/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ 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.10.1 h1:0O6j18nQDoIff6/mtosT5LNU2WehEwp+LqfX6699oqY=
github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1/go.mod h1:xdYAf5bjkOpsd3auA8riiJW4vneBubt9caavL7626jQ=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261104063122-3efa339480ac h1:EvEUCt1uH5oBtPcJJPt1mX6XYQWAKtL9QBSo9CfeaOw=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261104063122-3efa339480ac/go.mod h1:pseCFRgm1rzBKomktjw6E0ayxmVE7XfHHiOmew4ka+g=
github.com/aws/aws-sdk-go-v2 v1.47.4 h1:bTvk6UdSSSvaQsfLVj1JRDEEqj/PDRwGf1KanaRzau0=
github.com/aws/aws-sdk-go-v2 v1.47.4/go.mod h1:XkrjAZvr705Nytv6PkPUhoSB2W9+vVHBp5oAWpkh8Ak=
github.com/aws/smithy-go v1.28.6 h1:Pj+/sUviNYjow8ELRtNwKHZ9ECeF+7pATX3+shjLIrw=
github.com/aws/smithy-go v1.28.6/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261109130250-81a709068bba h1:UmAWblM7ikU36NJ/aUq09HnHrXPQpNpe3WA0zQZEV2k=
github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261109130250-81a709068bba/go.mod h1:l9V+ecJCfAigYr6XiK9kpIUemF9bnXOKHJN1s4TPsM0=
github.com/aws/aws-sdk-go-v2 v1.47.5 h1:5yA+A+BiXbDq1ZLbYwPViwhEGDMdR0MEhL8Jh2LnLS4=
github.com/aws/aws-sdk-go-v2 v1.47.5/go.mod h1:iNIkogrRvFwm+1OQIUOP2lPBtlXZboOIUWiCa+pHEMw=
github.com/aws/smithy-go v1.28.7 h1:h/n1SHrwVtaDYLz8mR1/Kq4Xh4RaFbFW7bOYckg9mfE=
github.com/aws/smithy-go v1.28.7/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/golang-jwt/jwt/v5 v5.3.1 h1:kYf81DTWFe7t+1VvL7eS+jKFVWaUnK9cB1qbwn63YCY=
github.com/golang-jwt/jwt/v5 v5.3.1/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,29 @@ func TestHeldReservation_Table(t *testing.T) {
}
}

// TestHeldReservation_VariantPin pins the recent-purchase guard on
// GetRecommendations-shaped output: the held quantity is netted from every term
// and payment variant, not consumed by the first one in input order (#703).
func TestHeldReservation_VariantPin(t *testing.T) {
t.Parallel()
c := NewClient(nil, "sub", "eastus")
recs := variantsOf(t, c, legacyRedisRec("P1Y"), legacyRedisRec("P3Y"))
require.Len(t, recs, 4)
c.SetInventoryFactories(factoriesRows(nil, redisRow("held", "Premium_P1", "eastus", 1)))

passed, err := adjust(t, c, recs)
require.NoError(t, err)
type variant struct{ term, payment string }
got := map[variant]int{}
for _, r := range passed {
got[variant{r.Term, r.PaymentOption}] = r.Count
}
assert.Equal(t, map[variant]int{
{"1yr", "upfront"}: 1, {"1yr", "monthly"}: 1,
{"3yr", "upfront"}: 1, {"3yr", "monthly"}: 1,
}, got)
}

func TestNewClient_DefaultInventoryFactories(t *testing.T) {
t.Parallel()
for name, c := range map[string]*Client{
Expand Down
Loading