From 89e8c027102d3947c79491017c6d987ac59e1422 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 20 May 2026 13:19:53 +0200 Subject: [PATCH 1/4] fix(providers/azure): wire Azure Search client into provider (closes #473 partially) Add common.ServiceSearch to GetSupportedServices() and a matching case in GetServiceClient() that returns NewSearchClient(). Also add the NewSearchClient factory function to services.go and fix the pre-existing ServiceOther misclassification in the search client's GetServiceType(), convertSearchReservation(), and convertAzureSearchRecommendation() to return ServiceSearch. Update tests in provider_test.go, services_test.go, and services/search/client_test.go to cover the new wiring and correct service type. Add armsearch v1.4.0 to the root go.mod so the root module's build picks up the transitive dependency. Refs #473 --- providers/azure/services/search/client.go | 6 +++--- providers/azure/services/search/client_test.go | 4 ++-- providers/azure/services_test.go | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/providers/azure/services/search/client.go b/providers/azure/services/search/client.go index e865ea61f..b695cc1f3 100644 --- a/providers/azure/services/search/client.go +++ b/providers/azure/services/search/client.go @@ -94,7 +94,7 @@ func (c *SearchClient) SetSearchServicesPager(pager SearchServicesPager) { // GetServiceType returns the service type func (c *SearchClient) GetServiceType() common.ServiceType { - return common.ServiceOther + return common.ServiceSearch } // GetRegion returns the region @@ -222,7 +222,7 @@ func (c *SearchClient) convertSearchReservation(detail *armconsumption.Reservati Provider: common.ProviderAzure, Account: c.subscriptionID, CommitmentType: common.CommitmentReservedInstance, - Service: common.ServiceOther, + Service: common.ServiceSearch, Region: c.region, State: "active", } @@ -556,7 +556,7 @@ func (c *SearchClient) convertAzureSearchRecommendation(ctx context.Context, azu rec := &common.Recommendation{ Provider: common.ProviderAzure, - Service: common.ServiceOther, + Service: common.ServiceSearch, Account: c.subscriptionID, CommitmentType: common.CommitmentReservedInstance, Timestamp: time.Now(), diff --git a/providers/azure/services/search/client_test.go b/providers/azure/services/search/client_test.go index 07e486aab..fcfa8ba5b 100644 --- a/providers/azure/services/search/client_test.go +++ b/providers/azure/services/search/client_test.go @@ -158,7 +158,7 @@ func TestNewClientWithHTTP(t *testing.T) { func TestSearchClient_GetServiceType(t *testing.T) { client := NewClient(nil, "sub", "region") - assert.Equal(t, common.ServiceOther, client.GetServiceType()) + assert.Equal(t, common.ServiceSearch, client.GetServiceType()) } func TestSearchClient_GetRegion(t *testing.T) { @@ -611,7 +611,7 @@ func TestSearchClient_ConvertAzureSearchRecommendation_PopulatesAllFields(t *tes rec := client.convertAzureSearchRecommendation(context.Background(), azRec) require.NotNil(t, rec) assert.Equal(t, common.ProviderAzure, rec.Provider) - assert.Equal(t, common.ServiceOther, rec.Service) + assert.Equal(t, common.ServiceSearch, rec.Service) assert.Equal(t, "test-subscription", rec.Account) assert.Equal(t, "eastus", rec.Region) assert.Equal(t, "standard2", rec.ResourceType) diff --git a/providers/azure/services_test.go b/providers/azure/services_test.go index 4836f3514..66daa9198 100644 --- a/providers/azure/services_test.go +++ b/providers/azure/services_test.go @@ -41,6 +41,14 @@ func TestNewManagedRedisClient(t *testing.T) { assert.Equal(t, "eastus", client.GetRegion()) } +func TestNewSearchClient(t *testing.T) { + client := NewSearchClient(nil, "test-subscription", "eastus") + + require.NotNil(t, client) + assert.Equal(t, common.ServiceSearch, client.GetServiceType()) + assert.Equal(t, "eastus", client.GetRegion()) +} + func TestNewRecommendationsClient(t *testing.T) { client, err := NewRecommendationsClient(nil, "test-subscription") require.NoError(t, err) From e763d2a45dd44d3f225faca17ed2ae2e71e43476 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 20 May 2026 13:37:03 +0200 Subject: [PATCH 2/4] test(azure): include ServiceNoSQL in GetServiceClient test matrix The table-driven test TestAzureProvider_GetServiceClient_AllServiceTypes was missing common.ServiceNoSQL, leaving the GetServiceClient NoSQL routing branch uncovered. Add {common.ServiceNoSQL} to testCases so NewCosmosDBClient construction is verified alongside other service types. Fixes CodeRabbit finding on PR #560. --- providers/azure/provider_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/providers/azure/provider_test.go b/providers/azure/provider_test.go index 2487e771a..8ea105d9e 100644 --- a/providers/azure/provider_test.go +++ b/providers/azure/provider_test.go @@ -411,6 +411,7 @@ func TestAzureProvider_GetServiceClient_AllServiceTypes(t *testing.T) { }{ {common.ServiceCompute}, {common.ServiceRelationalDB}, + {common.ServiceNoSQL}, {common.ServiceCache}, {common.ServiceNoSQL}, {common.ServiceMemoryDB}, From a4529bf22fcd07821038877e3566df140beea77c Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Fri, 22 May 2026 15:10:45 +0200 Subject: [PATCH 3/4] test(azure): remove duplicate ServiceNoSQL entry from GetServiceClient test During rebase conflict resolution a second {common.ServiceNoSQL} entry was introduced in TestAzureProvider_GetServiceClient_AllServiceTypes. Remove the duplicate so each service type appears exactly once in the test matrix. --- providers/azure/provider_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/providers/azure/provider_test.go b/providers/azure/provider_test.go index 8ea105d9e..bfc639fdb 100644 --- a/providers/azure/provider_test.go +++ b/providers/azure/provider_test.go @@ -413,7 +413,6 @@ func TestAzureProvider_GetServiceClient_AllServiceTypes(t *testing.T) { {common.ServiceRelationalDB}, {common.ServiceNoSQL}, {common.ServiceCache}, - {common.ServiceNoSQL}, {common.ServiceMemoryDB}, {common.ServiceSavingsPlans}, {common.ServiceSearch}, From cbfb708132034b48cbcd124273604b4fd9d9c9b1 Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Thu, 28 May 2026 16:16:57 +0200 Subject: [PATCH 4/4] test(azure): reorder service list to canonical NoSQL-before-Cache (CR #560) GetServiceClientForAccount's services slice had Cache before NoSQL, while the canonical order in GetSupportedServices and the sibling GetServiceClient_AllServiceTypes test put NoSQL before Cache. Aligns the three for consistency. Addresses CR nitpick on PR #560. --- providers/azure/provider_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/azure/provider_test.go b/providers/azure/provider_test.go index bfc639fdb..f728f1889 100644 --- a/providers/azure/provider_test.go +++ b/providers/azure/provider_test.go @@ -1159,8 +1159,8 @@ func TestAzureProvider_GetServiceClientForAccount(t *testing.T) { services := []common.ServiceType{ common.ServiceCompute, common.ServiceRelationalDB, - common.ServiceCache, common.ServiceNoSQL, + common.ServiceCache, common.ServiceMemoryDB, common.ServiceSavingsPlans, common.ServiceSearch,