Skip to content

Provide an interface for the ResiliencePipelineProvider #1652

Closed

Description

@SeanFarrow

Is your feature request related to a specific problem? Or an existing feature? Please describe.
I like to be able to test classes usinghte new ResiliencePipelineProvider infrastructure. Currently this is made hard by the fact that there is no interface like the old registries.

Describe your proposed or preferred solution:
Can we have an IResiliencePipelineProvider that is registered with DI so that this can be injected in to classes.

Describe any alternative options you've considered:
There aren't really any for this problem.

Any additional info?
I'm happy to extract an interface an provide a PR if this is wanted for V8.

Activity

  1. martincostello commented on Sep 27, 2023

    @martincostello
    Member

    Have you taken a look at our new Polly v8 documentation for testing?

    Does that and/or the Polly.Testing package help with what you're trying to achieve?

    We're hours away from shipping Polly 8.0.0 and are basically code complete at this point, so I'm not sure at this point we'd delay to go through API review to consider adding new interfaces (we've avoided new interfaces for most (all?) of the new API surface).

    There shouldn't be anything in the current design that prevents you from using DI and injecting things, they're just abstract classes instead of interfaces, and we have the empty builder you can use that is the successor to a no-op policy.

  2. SeanFarrow commented on Sep 27, 2023

    @SeanFarrow
    ContributorAuthor
  3. martincostello commented on Sep 28, 2023

    @martincostello
    Member

    it may be worth adding something to the testing docs (post V8) to show how to mock out the ResiliencePipelineProvider as I can see people wanting to do this particularly when they are migrating from using the registry interfaces.

    @martintmk @peter-csala Thoughts on the above?

  4. peter-csala commented on Sep 28, 2023

    @peter-csala
    Contributor

    it may be worth adding something to the testing docs (post V8) to show how to mock out the ResiliencePipelineProvider as I can see people wanting to do this particularly when they are migrating from using the registry interfaces.

    @martintmk @peter-csala Thoughts on the above?

    Hey @SeanFarrow could you please share with us the related V7 code that you would like to migrate/port to V8?

    So, basically we would like to understand what exactly do you want to achieve with the new API.

  5. SeanFarrow commented on Sep 28, 2023

    @SeanFarrow
    ContributorAuthor
  6. martintmk commented on Sep 29, 2023

    @martintmk
    Contributor

    This is definitely doable, but I wonder whether it would be worth adding something to the docs to show how this is done (if it doesn’t already exist) and how to use these new base classes in testing.

    I think so. Mocking the ResiliencePipelineProvider is something that should be encouraged. I'll prepare some docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions