Skip to content

Commit

Permalink
Improve the test
Browse files Browse the repository at this point in the history
  • Loading branch information
martintmk committed Jul 10, 2023
1 parent 444de24 commit 66af7d6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public partial class IssuesTests
[Fact]
public void StrategiesPerEndpoint_1365()
{
var events = new List<MeteringEvent>();
using var listener = TestUtilities.EnablePollyMetering(events);
var services = new ServiceCollection();

services.AddResilienceStrategy<string>();
Expand Down Expand Up @@ -75,7 +77,7 @@ public void StrategiesPerEndpoint_1365()
options.StrategyComparer = new EndpointKey.StrategyComparer();
// format the key for telemetry
options.StrategyKeyFormatter = key => $"{key.BuilderName}-{key.EndpointName}-{key.Resource}";
options.InstanceNameFormatter = key => $"{key.EndpointName}/{key.Resource}";
// format the builder name for telemetry
options.BuilderNameFormatter = key => key.BuilderName;
Expand All @@ -94,6 +96,11 @@ public void StrategiesPerEndpoint_1365()
strategy1.Should().NotBe(strategy2);
provider.GetStrategy(resource1Key).Should().BeSameAs(strategy1);
provider.GetStrategy(resource2Key).Should().BeSameAs(strategy2);

strategy1.Execute(() => { });
events.Should().HaveCount(3);
events[0].Tags["builder-name"].Should().Be("endpoint-pipeline");
events[0].Tags["builder-instance"].Should().Be("Endpoint 1/Resource 1");
}

public class EndpointOptions
Expand Down

0 comments on commit 66af7d6

Please sign in to comment.