Skip to content

Commit

Permalink
Adjust unit-test of CleanIdleExecutive_Test
Browse files Browse the repository at this point in the history
  • Loading branch information
chopin-fan committed Jul 19, 2024
1 parent c4170cf commit cd63c06
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public async Task CleanIdleExecutive_Test()
};

var executives = new List<IExecutive>();
for (var i = 0; i < 11; i++)
for (var i = 0; i < 51; i++)
{
var executive = await _smartContractExecutiveService.GetExecutiveAsync(chainContext, address);
executives.Add(executive);
Expand All @@ -199,23 +199,23 @@ public async Task CleanIdleExecutive_Test()
foreach (var executive in executives)
await _smartContractExecutiveService.PutExecutiveAsync(chainContext, address, executive);
_smartContractExecutiveProvider.TryGetValue(address, out pool);
pool.Count.ShouldBe(11);
pool.Count.ShouldBe(51);
_smartContractExecutiveService.CleanIdleExecutive();
pool.Count.ShouldBe(10);
pool.Count.ShouldBe(50);
_smartContractExecutiveProvider.TryGetValue(address, out pool);
pool.Count.ShouldBe(10);
pool.Count.ShouldBe(50);

pool.TryPeek(out var item);
item.LastUsedTime = item.LastUsedTime.AddHours(-2);
_smartContractExecutiveService.CleanIdleExecutive();
_smartContractExecutiveProvider.TryGetValue(address, out pool);
pool.Count.ShouldBe(9);
pool.Count.ShouldBe(49);

pool.TryPeek(out item);
item.LastUsedTime = item.LastUsedTime.AddHours(-2);
_smartContractExecutiveService.CleanIdleExecutive();
_smartContractExecutiveProvider.TryGetValue(address, out pool);
pool.Count.ShouldBe(8);
pool.Count.ShouldBe(48);
}

[Fact]
Expand Down

0 comments on commit cd63c06

Please sign in to comment.