Skip to content

Commit

Permalink
Fixing tests - was getting error during indexing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Feb 18, 2014
1 parent 834da65 commit 2f66994
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
13 changes: 12 additions & 1 deletion Raven.Database/Tasks/TouchMissingReferenceDocumentTask.cs
Expand Up @@ -29,7 +29,18 @@ public override void Merge(Task task)
{
var t = (TouchMissingReferenceDocumentTask)task;

MissingReferences = MissingReferences.Union(t.MissingReferences).ToDictionary(x => x.Key, x => x.Value);
foreach (var kvp in t.MissingReferences)
{
HashSet<string> set;
if (MissingReferences.TryGetValue(kvp.Key, out set) == false)
{
MissingReferences[kvp.Key] = kvp.Value;
}
else
{
set.UnionWith(kvp.Value);
}
}
}

public override void Execute(WorkContext context)
Expand Down
5 changes: 4 additions & 1 deletion Raven.Tests.Helpers/RavenTestBase.cs
Expand Up @@ -254,7 +254,10 @@ public static void WaitForIndexing(IDocumentStore store, string db = null,TimeSp
var databaseCommands = store.DatabaseCommands;
if (db != null)
databaseCommands = databaseCommands.ForDatabase(db);
Assert.True(SpinWait.SpinUntil(() => databaseCommands.GetStatistics().StaleIndexes.Length == 0, timeout ?? TimeSpan.FromSeconds(20)));
bool spinUntil = SpinWait.SpinUntil(() => databaseCommands.GetStatistics().StaleIndexes.Length == 0, timeout ?? TimeSpan.FromSeconds(20));
if (spinUntil == false)
WaitForUserToContinueTheTest((EmbeddableDocumentStore) store);
Assert.True(spinUntil);
}

public static void WaitForIndexing(DocumentDatabase db)
Expand Down
2 changes: 1 addition & 1 deletion Raven.Tests/Issues/RavenDB_1280.cs
Expand Up @@ -75,7 +75,7 @@ public void CanHandleMultipleMissingDocumentsInMultipleIndexes()
session.SaveChanges();
}

WaitForIndexing(store);
WaitForIndexing(store, timeout: TimeSpan.FromSeconds(10));
}
}

Expand Down
5 changes: 3 additions & 2 deletions Raven.Tryouts/Program.cs
@@ -1,4 +1,5 @@
using System;
using Raven.Tests.Indexes;
using Raven.Tests.Issues;
using Xunit;

Expand All @@ -12,9 +13,9 @@ private static void Main(string[] args)
{
Environment.SetEnvironmentVariable("run", string.Format("{0:0000}", i));
Console.WriteLine(i);
using (var x = new RavenDB_1041())
using (var x = new RavenDB_1280())
{
x.CanWaitForReplication().Wait();
x.CanHandleMultipleMissingDocumentsInMultipleIndexes();
}
}
}
Expand Down

0 comments on commit 2f66994

Please sign in to comment.