Skip to content

Commit

Permalink
RavenDB-20446 Trying to get more info about indexing errors once we g…
Browse files Browse the repository at this point in the history
…et timeout exception on query
  • Loading branch information
arekpalinski committed Nov 22, 2023
1 parent 83a7a05 commit fe6492e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions test/SlowTests/Issues/RavenDB_12269.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Threading.Tasks;
using System;
using System.Linq;
using System.Threading.Tasks;
using FastTests;
using Raven.Client;
using Raven.Client.Documents;
Expand Down Expand Up @@ -79,8 +81,20 @@ public async Task Changing_index_def_must_not_error_index()
await session.SaveChangesAsync();

// this will ensure that index isn't in error state
var count = await session.Query<User>("Users_ByName").Customize(x => x.WaitForNonStaleResults()).CountAsync();
Assert.Equal(3, count);
try
{
var count = await session.Query<User>("Users_ByName").Customize(x => x.WaitForNonStaleResults()).CountAsync();
Assert.Equal(3, count);
}
catch (TimeoutException e)
{
var errors = Indexes.WaitForIndexingErrors(store, new[] {"Users_ByName"}, errorsShouldExists: true);

if (errors != null && errors.Length > 0 && errors[0].Errors.Length > 0)
throw new AggregateException($"Got the following index errors: {(string.Join(',', errors[0].Errors.SelectMany(x => x.Error)))}", e);

throw;
}
}
}
}
Expand Down

0 comments on commit fe6492e

Please sign in to comment.