Skip to content

Commit

Permalink
RavenDB-23100 - update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grisha-kotler authored and ppekrol committed Nov 22, 2024
1 parent 9ea29b5 commit 5b28cd4
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions test/SlowTests/Issues/RavenDB-23100.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ public RavenDB_23100(ITestOutputHelper output) : base(output)
{
}

private const string EmployeeId1 = "Employ&es/1-A";
private const string EmployeeId2 = "EmPlo#ees/2-A";
private const string CompanyId = "COMan!es/1-A";
private const string EmployeeId1 = "Em\tploy&es/1-A";
private const string EmployeeId2 = "EmPl\ro#ees/2-A";
private const string CompanyId = "COM\ban!es/1-A";

private static readonly Company _company = new Company { Id = CompanyId, Name = "RavenDB" };
private static readonly Employee _employee1 = new Employee { Id = EmployeeId1, CompanyId = _company.Id };
private static readonly Employee _employee2 = new Employee { Id = EmployeeId2, CompanyId = _company.Id };

private const string LegacyEmployeeId1 = "Employ&es/1-A";
private const string LegacyEmployeeId2 = "EmPlo#ees/2-A";
private const string LegacyCompanyId = "COMan!es/1-A";

[RavenTheory(RavenTestCategory.Indexes)]
[InlineData(typeof(DocumentsIndex))]
[InlineData(typeof(DocumentsIndexMapReduce))]
Expand Down Expand Up @@ -137,7 +141,7 @@ public async Task Can_Delete_Document_References_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
var company = await session.LoadAsync<Company>(CompanyId);
var company = await session.LoadAsync<Company>(LegacyCompanyId);
company.Name += " LTD";
await session.SaveChangesAsync();
}
Expand All @@ -159,8 +163,8 @@ public async Task Can_Delete_Document_References_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
session.Delete(EmployeeId1);
session.Delete(EmployeeId2);
session.Delete(LegacyEmployeeId1);
session.Delete(LegacyEmployeeId2);
await session.SaveChangesAsync();
// deleting the documents won't change the internal references tree like in new indexes
}
Expand All @@ -178,7 +182,7 @@ public async Task Can_Delete_Document_References_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
var company = await session.LoadAsync<Company>(CompanyId);
var company = await session.LoadAsync<Company>(LegacyCompanyId);
company.Name += " HR";
await session.SaveChangesAsync();
// when we update the references, this will clean the leftovers
Expand Down Expand Up @@ -237,7 +241,7 @@ public async Task Can_Delete_Document_References_Map_Reduce_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
var company = await session.LoadAsync<Company>(CompanyId);
var company = await session.LoadAsync<Company>(LegacyCompanyId);
company.Name += " LTD";
await session.SaveChangesAsync();
}
Expand All @@ -255,8 +259,8 @@ public async Task Can_Delete_Document_References_Map_Reduce_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
session.Delete(EmployeeId1);
session.Delete(EmployeeId2);
session.Delete(LegacyEmployeeId1);
session.Delete(LegacyEmployeeId2);
await session.SaveChangesAsync();
// deleting the documents won't change the internal references tree like in new indexes
}
Expand All @@ -274,7 +278,7 @@ public async Task Can_Delete_Document_References_Map_Reduce_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
var company = await session.LoadAsync<Company>(CompanyId);
var company = await session.LoadAsync<Company>(LegacyCompanyId);
company.Name += " HR";
await session.SaveChangesAsync();
// when we update the references, this will clean the leftovers
Expand Down Expand Up @@ -408,7 +412,7 @@ public async Task Can_Delete_CompareExchange_References_For_Legacy_Index()

using (var session = store.OpenAsyncSession(new SessionOptions { TransactionMode = TransactionMode.ClusterWide }))
{
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(CompanyId);
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(LegacyCompanyId);
company.Value.Name += " LTD";
await session.SaveChangesAsync();
}
Expand All @@ -430,8 +434,8 @@ public async Task Can_Delete_CompareExchange_References_For_Legacy_Index()

using (var session = store.OpenAsyncSession())
{
session.Delete(EmployeeId1);
session.Delete(EmployeeId2);
session.Delete(LegacyEmployeeId1);
session.Delete(LegacyEmployeeId2);
await session.SaveChangesAsync();
// deleting the documents won't change the internal references tree like in new indexes
}
Expand All @@ -449,7 +453,7 @@ public async Task Can_Delete_CompareExchange_References_For_Legacy_Index()

using (var session = store.OpenAsyncSession(new SessionOptions { TransactionMode = TransactionMode.ClusterWide }))
{
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(CompanyId);
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(LegacyCompanyId);
company.Value.Name += " HR";
await session.SaveChangesAsync();
// when we update the references, this will clean the leftovers
Expand Down Expand Up @@ -508,7 +512,7 @@ public async Task Can_Delete_CompareExchange_References_For_Legacy_Index_Map_Red

using (var session = store.OpenAsyncSession(new SessionOptions { TransactionMode = TransactionMode.ClusterWide }))
{
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(CompanyId);
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(LegacyCompanyId);
company.Value.Name += " LTD";
await session.SaveChangesAsync();
}
Expand All @@ -524,8 +528,8 @@ public async Task Can_Delete_CompareExchange_References_For_Legacy_Index_Map_Red

using (var session = store.OpenAsyncSession())
{
session.Delete(EmployeeId1);
session.Delete(EmployeeId2);
session.Delete(LegacyEmployeeId1);
session.Delete(LegacyEmployeeId2);
await session.SaveChangesAsync();
// deleting the documents won't change the internal references tree like in new indexes
}
Expand All @@ -543,7 +547,7 @@ public async Task Can_Delete_CompareExchange_References_For_Legacy_Index_Map_Red

using (var session = store.OpenAsyncSession(new SessionOptions { TransactionMode = TransactionMode.ClusterWide }))
{
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(CompanyId);
var company = await session.Advanced.ClusterTransaction.GetCompareExchangeValueAsync<Company>(LegacyCompanyId);
company.Value.Name += " HR";
await session.SaveChangesAsync();
// when we update the references, this will clean the leftovers
Expand Down

0 comments on commit 5b28cd4

Please sign in to comment.