Skip to content

Commit

Permalink
Will only consider documents for the entity name to cause staleness i…
Browse files Browse the repository at this point in the history
…n the index
  • Loading branch information
ayende committed Aug 11, 2010
1 parent f512465 commit c01432b
Show file tree
Hide file tree
Showing 8 changed files with 727 additions and 647 deletions.
40 changes: 40 additions & 0 deletions Raven.Client.Tests/Bugs/StalenessWontAffectUnrelatedIndexes.cs
@@ -0,0 +1,40 @@
using System.Threading;
using Raven.Database.Data;
using Raven.Database.Indexing;
using Xunit;

namespace Raven.Client.Tests.Bugs
{
public class StalenessWontAffectUnrelatedIndexes : BaseClientTest
{
[Fact]
public void AddingUnrealtedDocumentWontChagneIndexStaleness()
{
using(var store = NewDocumentStore())
{
store.DatabaseCommands.PutIndex("Test", new IndexDefinition
{
Map = "from doc in docs.Cops select new { doc.Badge }"
});

while(store.DatabaseCommands.Query("Test", new IndexQuery(), null).IsStale)
Thread.Sleep(100);

store.DocumentDatabase.StopBackgroundWokers();

using(var session = store.OpenSession())
{
session.Store(new AutoDetectAnaylzersForQuery.Foo
{
Name = "blah"
});
session.SaveChanges();
}


Assert.False(store.DatabaseCommands.Query("Test", new IndexQuery(), null).IsStale);

}
}
}
}
1 change: 1 addition & 0 deletions Raven.Client.Tests/Raven.Client.Tests.csproj
Expand Up @@ -122,6 +122,7 @@
<Compile Include="Bugs\SinglePropertyDocument.cs" />
<Compile Include="Bugs\ProjectingDates.cs" />
<Compile Include="Bugs\SortingOnLong.cs" />
<Compile Include="Bugs\StalenessWontAffectUnrelatedIndexes.cs" />
<Compile Include="Bugs\WithPrivateProtectedSetter.cs" />
<Compile Include="Document\AsyncDocumentStoreServerTests.cs" />
<Compile Include="Document\ClientKeyGeneratorTests.cs" />
Expand Down

0 comments on commit c01432b

Please sign in to comment.