Skip to content

Commit

Permalink
RavenDB-20687 : add more debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
aviv86 committed Sep 18, 2023
1 parent 35d3d83 commit 3b48b65
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/SlowTests/Server/Documents/ETL/Raven/BasicRavenEtlTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FastTests;
using Newtonsoft.Json;
using Raven.Client;
using Raven.Client.Documents;
using Raven.Client.Documents.Operations;
Expand Down Expand Up @@ -688,7 +690,7 @@ public async Task Update_of_disassembled_document(RavenDatabaseMode srcDbMode, R

var timeout = TimeSpan.FromSeconds(30);

Assert.True(etlDone.Wait(timeout), await Etl.GetEtlDebugInfo(src.Database, timeout, srcDbMode));
Assert.True(etlDone.Wait(timeout), await AddDebugInfo(src, dest, timeout, srcDbMode));

using (var session = dest.OpenSession())
{
Expand Down Expand Up @@ -919,6 +921,22 @@ private long GetCountOfDocuments(IDocumentStore store)
return docsCount;
}

private async Task<string> AddDebugInfo(IDocumentStore src, IDocumentStore dst, TimeSpan timeout, RavenDatabaseMode srcDbMode)
{
var sb = new StringBuilder()
.AppendLine($"ETL from '{src.Database}' failed to reach destination '{dst.Database}':");

var etlInfo = await Etl.GetEtlDebugInfo(src.Database, timeout, srcDbMode);
sb.AppendLine(etlInfo).AppendLine();

var record = await dst.Maintenance.Server.SendAsync(new GetDatabaseRecordOperation(dst.Database));

sb.AppendLine("destination database record:")
.AppendLine(JsonConvert.SerializeObject(record));

return sb.ToString();
}

private class UserWithAddress : User
{
public Address Address { get; set; }
Expand Down

0 comments on commit 3b48b65

Please sign in to comment.