Skip to content

Commit 145105c

Browse files
committed
Fix build
1 parent 992e4e3 commit 145105c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Servers/Kestrel/Core/test/PinnedBlockMemoryPoolTests.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ public async Task EvictionsAreScheduled()
229229
}
230230

231231
[Fact]
232-
public void CurrentMemoryMetricTracksPooledMemory()
232+
public void PooledMemoryMetricTracksPooledMemory()
233233
{
234234
var testMeterFactory = new TestMeterFactory();
235-
using var currentMemoryMetric = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.MemoryPool", MemoryPoolMetrics.UsedMemoryName);
235+
using var currentMemoryMetric = new MetricCollector<long>(testMeterFactory, "Microsoft.AspNetCore.MemoryPool", MemoryPoolMetrics.PooledMemoryName);
236236

237237
var pool = CreateMemoryPool(owner: "test", meterFactory: testMeterFactory);
238238

@@ -282,6 +282,18 @@ public void TotalAllocatedMetricTracksAllocatedMemory()
282282
var mem1 = pool.Rent();
283283
var mem2 = pool.Rent();
284284

285+
Assert.Collection(totalMemoryMetric.GetMeasurementSnapshot(),
286+
m =>
287+
{
288+
Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value);
289+
Assert.Equal("test", (string)m.Tags["aspnetcore.memory_pool.owner"]);
290+
},
291+
m =>
292+
{
293+
Assert.Equal(PinnedBlockMemoryPool.BlockSize, m.Value);
294+
Assert.Equal("test", (string)m.Tags["aspnetcore.memory_pool.owner"]);
295+
});
296+
285297
// Each Rent that allocates a new block should increment total memory by block size
286298
Assert.Equal(2 * PinnedBlockMemoryPool.BlockSize, totalMemoryMetric.GetMeasurementSnapshot().EvaluateAsCounter());
287299

0 commit comments

Comments
 (0)