From 80cb467c6dbb9eaf998d556b56d8756d136fa884 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Tue, 13 Oct 2026 20:03:10 +0200 Subject: [PATCH 1/2] test(sp): audit record carries recurring_monthly_cost for no-upfront Savings Plans Pins the CLI side of cli#2179: the audit line keeps estimated_cost as the upfront payment and adds recurring_monthly_cost. The behaviour comes from the cloud-commitments-go pkg bump (go#359); the go.mod bump lands once that merges. Refs #2179 Co-Authored-By: Claude Opus 5.5 --- cmd/audit_recurring_cost_test.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 cmd/audit_recurring_cost_test.go diff --git a/cmd/audit_recurring_cost_test.go b/cmd/audit_recurring_cost_test.go new file mode 100644 index 000000000..5bcd36851 --- /dev/null +++ b/cmd/audit_recurring_cost_test.go @@ -0,0 +1,31 @@ +package main + +import ( + "encoding/json" + "os" + "path/filepath" + "testing" + + "github.com/LeanerCloud/cloud-commitments-go/pkg/common" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestWritePurchaseAuditRecord_SavingsPlanCarriesRecurringMonthlyCost(t *testing.T) { + recurring := 1968.81 + rec := common.Recommendation{ + Provider: common.ProviderAWS, Service: common.ServiceSavingsPlansEC2Instance, + CommitmentType: common.CommitmentSavingsPlan, Term: "1yr", PaymentOption: "no-upfront", + Count: 1, RecurringMonthlyCost: &recurring, + } + path := filepath.Join(t.TempDir(), "audit.jsonl") + + require.NoError(t, writePurchaseAuditRecord("run-1", rec, common.PurchaseResult{Recommendation: rec}, "skipped", true, path)) + + data, err := os.ReadFile(path) + require.NoError(t, err) + var line map[string]any + require.NoError(t, json.Unmarshal(data, &line)) + assert.Equal(t, 0.0, line["estimated_cost"], "upfront stays where it was") + assert.Equal(t, 1968.81, line["recurring_monthly_cost"]) +} From 24d90d5ccc955e7570735262c95589574d711250 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Tue, 13 Oct 2026 20:42:48 +0200 Subject: [PATCH 2/2] build(deps): bump cloud-commitments-go pkg and providers/aws to e9a33bb Brings the audit recurring_monthly_cost field and the Recurring$/mo table column. Refs #2179 Co-Authored-By: Claude Opus 5.5 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 8389b9b41..9f915c246 100644 --- a/go.mod +++ b/go.mod @@ -82,8 +82,8 @@ require ( require ( github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v2 v2.2.0 - github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261012195142-218912bb8cb9 - github.com/LeanerCloud/cloud-commitments-go/providers/aws v0.0.0-20261012195142-218912bb8cb9 + github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261013184038-e9a33bb14d0d + github.com/LeanerCloud/cloud-commitments-go/providers/aws v0.0.0-20261013184038-e9a33bb14d0d github.com/LeanerCloud/cloud-commitments-go/providers/azure v0.0.0-20261007133317-58c25f04c49b github.com/LeanerCloud/cloud-commitments-go/providers/gcp v0.0.0-20261006205158-7ff8c1aee1bb github.com/aws/aws-sdk-go-v2/service/organizations v1.45.3 diff --git a/go.sum b/go.sum index f857c05f1..a2f4806a1 100644 --- a/go.sum +++ b/go.sum @@ -78,10 +78,10 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0 github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.54.0/go.mod h1:vB2GH9GAYYJTO3mEn8oYwzEdhlayZIdQz6zdzgUIRvA= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.54.0 h1:s0WlVbf9qpvkh1c/uDAPElam0WrL7fHRIidgZJ7UqZI= github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.54.0/go.mod h1:Mf6O40IAyB9zR/1J8nGDDPirZQQPbYJni8Yisy7NTMc= -github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261012195142-218912bb8cb9 h1:b1AVTF1yVwPgWo9/6SlNVO460EMqWTsLZ2BSKcrwfjA= -github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261012195142-218912bb8cb9/go.mod h1:8RTmzPazA8IeVZfn7wNaU7ILx0VK5eHZQozO21Mvtq8= -github.com/LeanerCloud/cloud-commitments-go/providers/aws v0.0.0-20261012195142-218912bb8cb9 h1:We82Ai0sL37/PTC14qIJub8B+d06qWHFnIco5XhVX2U= -github.com/LeanerCloud/cloud-commitments-go/providers/aws v0.0.0-20261012195142-218912bb8cb9/go.mod h1:fiu6WQmUGRdViiOf45QV235Cowq8j0yn8ahGWCGEFn8= +github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261013184038-e9a33bb14d0d h1:LzTtaDpdS0FJJ0x9kRbrrn4Zrm85HLccnO9L8Wp8toc= +github.com/LeanerCloud/cloud-commitments-go/pkg v0.0.0-20261013184038-e9a33bb14d0d/go.mod h1:8RTmzPazA8IeVZfn7wNaU7ILx0VK5eHZQozO21Mvtq8= +github.com/LeanerCloud/cloud-commitments-go/providers/aws v0.0.0-20261013184038-e9a33bb14d0d h1:NlNTNHOpftHUfSNmVJKAHhA6RP0uLRJOAlk8xmhJjy8= +github.com/LeanerCloud/cloud-commitments-go/providers/aws v0.0.0-20261013184038-e9a33bb14d0d/go.mod h1:no7i/7i+W37+qhEOVU8F/0dP5FhO3wtzvKIN0+tvL3A= github.com/LeanerCloud/cloud-commitments-go/providers/azure v0.0.0-20261007133317-58c25f04c49b h1:yurugmfdZjf+dqjfqfDyfoBR3IAiFUpMKQ8URnZnJzQ= github.com/LeanerCloud/cloud-commitments-go/providers/azure v0.0.0-20261007133317-58c25f04c49b/go.mod h1:iIvPuWLWd+SXqLHAQNdodYMUAAcq7PnwfScXWgARt5A= github.com/LeanerCloud/cloud-commitments-go/providers/gcp v0.0.0-20261006205158-7ff8c1aee1bb h1:AJ4nKDtttjiTDemo9PDp2esoc35ymVaiCSr0zIewwpY=