From db6b5d89410164cbc44ba064634f9326535cf942 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Fri, 22 May 2026 15:10:08 +0200 Subject: [PATCH] test(azure/savingsplans): add regression test for bad payment option TestGetOfferingDetails_BadPaymentOption asserts that an unknown payment option ("Quarterly") returns an error containing "unsupported payment option" and does not silently fall back to no-upfront. Addresses the CodeRabbit finding from PR #592. --- .../azure/services/savingsplans/client_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/providers/azure/services/savingsplans/client_test.go b/providers/azure/services/savingsplans/client_test.go index 90d0af196..bff5aa1c2 100644 --- a/providers/azure/services/savingsplans/client_test.go +++ b/providers/azure/services/savingsplans/client_test.go @@ -389,6 +389,19 @@ func TestGetOfferingDetails_BadTerm(t *testing.T) { assert.Contains(t, err.Error(), "unsupported savings plan term") } +func TestGetOfferingDetails_BadPaymentOption(t *testing.T) { + c := NewClient(nil, "sub", "eastus") + rec := common.Recommendation{ + Term: "1yr", + PaymentOption: "Quarterly", + Details: &common.SavingsPlanDetails{PlanType: "Compute", HourlyCommitment: 1.0}, + } + + _, err := c.GetOfferingDetails(context.Background(), rec) + require.Error(t, err) + assert.Contains(t, err.Error(), "unsupported payment option") +} + func TestGetOfferingDetails_WrongDetails(t *testing.T) { c := NewClient(nil, "sub", "eastus") rec := common.Recommendation{Term: "1yr", Details: nil}