forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RavenDB_19900: added an option to modify the timeout of GetDatabaseTo…
…pologyCommand
- Loading branch information
1 parent
93446d0
commit 185b49b
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Threading.Tasks; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using System; | ||
using Raven.Client.Http; | ||
using Tests.Infrastructure; | ||
|
||
|
||
namespace SlowTests.Issues | ||
{ | ||
public class RavenDB_19900 : ClusterTestBase | ||
{ | ||
public RavenDB_19900(ITestOutputHelper output) : base(output) | ||
{ | ||
} | ||
|
||
[Fact] | ||
public async Task UpdateTopologyTimeoutBehaviourShouldBeAccordingToConfiguration() | ||
{ | ||
var timeout1 = TimeSpan.FromSeconds(20); | ||
using (var store = GetDocumentStore()) | ||
{ | ||
var executor = store.GetRequestExecutor(); | ||
|
||
// delaying response should result in UpdateTopology timeout | ||
var testingStuff = executor.ForTestingPurposesOnly(); | ||
var e = await Assert.ThrowsAsync<TimeoutException>(async () => await UpdateTopology()); | ||
Assert.Contains("failed with timeout after 00:00:15", e.ToString()); | ||
|
||
// increasing the general timeout should let UpdateTopology() to be executed | ||
store.SetRequestTimeout(timeout1); | ||
await UpdateTopology(); | ||
|
||
async Task UpdateTopology() | ||
{ | ||
var node = executor.GetPreferredNode().Result.Node; | ||
var topologyUpdateCommand = new RequestExecutor.UpdateTopologyParameters(node); | ||
await executor.UpdateTopologyAsync(topologyUpdateCommand); | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
|