Skip to content

Commit

Permalink
RavenDB-21757 - fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
garayx authored and arekpalinski committed May 6, 2024
1 parent 9327ff8 commit 444193a
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ShardedSubscriptionClusterTests(ITestOutputHelper output) : base(output)
{
}

private readonly TimeSpan _reasonableWaitTime = Debugger.IsAttached ? TimeSpan.FromMinutes(15) : TimeSpan.FromSeconds(3000);
private readonly TimeSpan _reasonableWaitTime = Debugger.IsAttached ? TimeSpan.FromMinutes(15) : TimeSpan.FromSeconds(60);

[RavenFact(RavenTestCategory.Sharding | RavenTestCategory.Subscriptions | RavenTestCategory.Cluster)]
public async Task CanRunShardedSubscriptionInCluster()
Expand Down Expand Up @@ -171,29 +171,26 @@ public async Task SubscriptionShouldTryConnectWithTimeoutIfShardUnavailable()

var mre = new AsyncManualResetEvent();
var mre2 = new AsyncManualResetEvent();
List<string> results = new List<string>();
HashSet<string> results = new HashSet<string>();
using (var subscription = store.Subscriptions.GetSubscriptionWorker(new SubscriptionWorkerOptions(id)))
{
var c = 0;
var t = subscription.Run(x =>
{
foreach (var item in x.Items)
{
c++;
results.Add(item.Id);
}
if (c == expectedIds.Count)
if (results.Count == expectedIds.Count)
mre.Set();
if (c == expectedIds.Count + expectedIds2.Count)
if (results.Count == expectedIds.Count + expectedIds2.Count)
mre2.Set();
});

Assert.True(await mre.WaitAsync(_reasonableWaitTime),$"error: {t.Exception}");

Assert.All(expectedIds, s => Assert.Contains(s, results));
results.Clear();

var dispsoedNode = nodes.FirstOrDefault(x => x.ServerStore.NodeTag == disposed.First());
Assert.NotNull(dispsoedNode);
Expand Down

0 comments on commit 444193a

Please sign in to comment.