testcontainers-dotnet icon indicating copy to clipboard operation
testcontainers-dotnet copied to clipboard

feat: Add http wait strategy

Open sumihiran opened this issue 3 years ago • 0 comments

Adds external http wait strategy as an extension of IWaitForContainerOS. In doing so, http wait strategy can be chained with OS specific ones. I am opening this PR for feedback.

Todo

  • [X] Wait for status code
  • [ ] TLS
  • [ ] Request headers
  • [ ] Basic authentication
  • [ ] Response predicate

Example

var waitRequestBuilder = HttpWaitRequest
    .ForPort(8024)
    .ForPath("/actuator/health")
    .ForStatusCode(200)
    .WithReadTimeout(TimeSpan.FromSeconds(5));

Wait.ForUnixContainer()
  .UntilPortIsAvailable(8024)
  .UntilHttpRequestIsCompleted(waitRequestBuilder.build())

sumihiran avatar Aug 05 '22 07:08 sumihiran