From 5dc3a85d5abde89084e6ff58f3044d956c5892e6 Mon Sep 17 00:00:00 2001 From: Austin Drenski Date: Tue, 9 Jan 2024 14:01:15 -0500 Subject: [PATCH] fix: Return correct name from FlagdProvider (#126) Signed-off-by: Austin Drenski Signed-off-by: Eric Pattison --- src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs | 5 +++-- .../FlagdProviderTest.cs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs b/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs index cdb5f26d..69f49f04 100644 --- a/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs +++ b/src/OpenFeature.Contrib.Providers.Flagd/FlagdProvider.cs @@ -27,10 +27,11 @@ namespace OpenFeature.Contrib.Providers.Flagd /// public sealed class FlagdProvider : FeatureProvider { + const string ProviderName = "flagd Provider"; static int EventStreamRetryBaseBackoff = 1; private readonly FlagdConfig _config; private readonly Service.ServiceClient _client; - private readonly Metadata _providerMetadata = new Metadata("flagd Provider"); + private readonly Metadata _providerMetadata = new Metadata(ProviderName); private readonly ICache _cache; private int _eventStreamRetries; @@ -121,7 +122,7 @@ internal FlagdProvider(Service.ServiceClient client, FlagdConfig config, ICache< /// public static string GetProviderName() { - return Api.Instance.GetProviderMetadata().Name; + return ProviderName; } /// diff --git a/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs b/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs index 848a257f..29a77dfc 100644 --- a/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs +++ b/test/OpenFeature.Contrib.Providers.Flagd.Test/FlagdProviderTest.cs @@ -65,7 +65,7 @@ public void BuildClientForPlatform_Should_Throw_Exception_For_Unsupported_DotNet [Fact] public void TestGetProviderName() { - Assert.Equal("No-op Provider", FlagdProvider.GetProviderName()); + Assert.Equal("flagd Provider", FlagdProvider.GetProviderName()); } [Fact]