-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -607,10 +607,9 @@ public async Task ShouldUseCustomFallbackHostIfProvided() | |
[Fact] | ||
[Trait("spec", "RSC15a")] | ||
[Trait("spec", "TO3k6")] | ||
public async Task ShouldUseProvidedCustomFallbackHostWhenDefaultHostIsDifferent() | ||
public async Task ShouldUseProvidedCustomFallbackHostsIrrespectiveOfPrimaryHost() | ||
{ | ||
_response.StatusCode = HttpStatusCode.BadGateway; | ||
var attemptedList = new List<string>(); | ||
var fallbackHosts = new[] | ||
{ | ||
"www.example1.com", | ||
|
@@ -619,18 +618,32 @@ public async Task ShouldUseProvidedCustomFallbackHostWhenDefaultHostIsDifferent( | |
"www.example4.com", | ||
"www.example5.com" | ||
}; | ||
var client = CreateClient(options => | ||
|
||
async Task CheckForAttemptedFallbackHosts(AblyRest client, string primaryHost) { | ||
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net7.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net7.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net6.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net6.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net7.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net7.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net6.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net6.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net6.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net6.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net7.0)
Check warning on line 622 in src/IO.Ably.Tests.Shared/Rest/RestSpecs.cs GitHub Actions / check (net7.0)
|
||
var attemptedList = new List<string>(); | ||
_handler.Requests.Clear(); | ||
await Assert.ThrowsAsync<AblyException>(() => MakeAnyRequest(client)); | ||
attemptedList.AddRange(_handler.Requests.Select(x => x.RequestUri.Host).ToList()); | ||
|
||
attemptedList.Count.Should().Be(6); | ||
attemptedList[0].Should().Be(primaryHost); | ||
attemptedList.Skip(1).Should().BeEquivalentTo(fallbackHosts); | ||
} | ||
|
||
var clientWithDefaultPrimaryHost = CreateClient(options => | ||
{ | ||
options.RestHost = "www.primaryhost.com"; | ||
options.FallbackHosts = fallbackHosts; | ||
options.HttpMaxRetryCount = 5; | ||
}); | ||
await Assert.ThrowsAsync<AblyException>(() => MakeAnyRequest(client)); | ||
attemptedList.AddRange(_handler.Requests.Select(x => x.RequestUri.Host).ToList()); | ||
await CheckForAttemptedFallbackHosts(clientWithDefaultPrimaryHost, "rest.ably.io"); | ||
|
||
attemptedList.Count.Should().Be(6); | ||
attemptedList[0].Should().Be("www.primaryhost.com"); | ||
attemptedList.Skip(1).Should().BeEquivalentTo(fallbackHosts); | ||
var clientWithCustomPrimaryHost = CreateClient(options => | ||
{ | ||
options.RestHost = "www.primaryhost.com"; | ||
options.FallbackHosts = fallbackHosts; | ||
options.HttpMaxRetryCount = 5; | ||
}); | ||
await CheckForAttemptedFallbackHosts(clientWithCustomPrimaryHost, "www.primaryhost.com"); | ||
} | ||
|
||
[Fact] | ||
|