Skip to content

Commit

Permalink
RavenDB-22986 - update test
Browse files Browse the repository at this point in the history
  • Loading branch information
grisha-kotler committed Nov 21, 2024
1 parent 2df7ca5 commit 68ad77e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/FastTests/Voron/Trees/FreeSpaceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,24 @@ public void CanUpdateMaxConsecutiveRanges()
var max = Env.FreeSpaceHandling.GetMaxConsecutiveRangePerSection(tx.LowLevelTransaction);
Assert.Equal(5, max.Count);

for (var i = 0; i < totalSections - 1; i++)
Assert.Equal(1, max[0].Max);
Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[0].StartBits);
Assert.Equal(0, max[0].EndBits);

for (var i = 1; i < totalSections - 1; i++)
{
Assert.Equal(1, max[i].Max);
Assert.Equal(1, max[i].StartBits);
Assert.Equal(0, max[i].EndBits);
}

Assert.Equal(2, max[3].Max);
Assert.Equal(1, max[3].StartBits);
Assert.Equal(1, max[3].EndBits);

Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[4].Max);
Assert.Equal(0, max[4].StartBits);
Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[4].EndBits);

// releasing 2 pages in section 4 to make 3 consecutive pages between two sections
Env.FreeSpaceHandling.FreePage(tx.LowLevelTransaction, totalPages);
Expand All @@ -310,6 +317,8 @@ public void CanUpdateMaxConsecutiveRanges()
max = Env.FreeSpaceHandling.GetMaxConsecutiveRangePerSection(tx.LowLevelTransaction);
Assert.Equal(4, max.Count);

Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[0].StartBits);

for (var i = 0; i < totalSections - 1; i++)
{
Assert.Equal(1, max[i].Max);
Expand All @@ -332,6 +341,8 @@ public void CanUpdateMaxConsecutiveRanges()

var max = Env.FreeSpaceHandling.GetMaxConsecutiveRangePerSection(tx.LowLevelTransaction);

Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[0].StartBits);

for (var i = 0; i < totalSections - 1; i++)
{
Assert.Equal(3, max[i].Max);
Expand All @@ -346,6 +357,8 @@ public void CanUpdateMaxConsecutiveRanges()
Assert.Equal(2, max[4].StartBits);

Assert.Equal(0, max[5].StartBits);
Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[5].EndBits);
Assert.Equal(FreeSpaceHandling.NumberOfPagesInSection, max[5].Max);

var page = tx.LowLevelTransaction.AllocatePage(3);
Assert.Equal(lastPageInAllSections, page.PageNumber);
Expand Down

0 comments on commit 68ad77e

Please sign in to comment.