arcus-azure/arcus.testing

Provide `Poll` mechanism that abstracts away polling

Closed this issue · 0 comments

Is your feature related to a problem? Please describe
Integration tests that deal with network or other resources that suffer from delays, are often a problem when writing test assertions. It would be good that Arcus already provides a good foundation to do polling in an easy and configurable manner.

What solution do you propose?
Create an abstract Poll builder mechanism that can be extended and configured. The most basic features are:

  • Until to configure the ‘what’ to poll for, this can either be something that has a result, or doesn’t (ex, until a HTTP endpoints returns 200 OK).
  • Every to configure the retry interval of each operation.
  • Timeout to configure the global timeout, when the entire polling should stop and the test should be considered failed.

Things to consider:

  • Use Polly internally to build upon retries.
  • Use ILogger overloads so that each poll operation can be logged.
  • Use both sync/async availability.
  • Take a look at https://github.com/stijnmoreels/FScenario where there is already a similar polling mechanism implemented.