Skip to content

Commit

Permalink
test: Fix failed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
s2quake committed Aug 30, 2024
1 parent 0892cef commit 3b09aa8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sdk/node/Libplanet.Node.Tests/RandomPrivateKey.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Libplanet.Common;
using Libplanet.Crypto;
using Libplanet.Net;

namespace Libplanet.Node.Tests;

Expand All @@ -15,4 +16,7 @@ public static implicit operator PrivateKey(RandomPrivateKey randomPrivateKey)
=> randomPrivateKey._privateKey;

public override string ToString() => ByteUtil.Hex(_privateKey.ByteArray);

public AppProtocolVersion ToAppProtocolVersion(int version)
=> AppProtocolVersion.Sign(_privateKey, version);
}
7 changes: 7 additions & 0 deletions sdk/node/Libplanet.Node.Tests/Services/SeedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public void Base_Test()
{
PrivateKey = privateKey.ToString(),
EndPoint = endPoint.ToString(),
AppProtocolVersion = privateKey.ToAppProtocolVersion(0).Token,
};
var seed = new Seed(options);
Assert.Equal(endPoint.Host, seed.BoundPeer.EndPoint.Host);
Expand All @@ -38,6 +39,7 @@ public async Task StartAsync_TestAsync()
{
PrivateKey = privateKey.ToString(),
EndPoint = endPoint.ToString(),
AppProtocolVersion = privateKey.ToAppProtocolVersion(0).Token,
};
await using var seed = new Seed(options);
await seed.StartAsync(cancellationToken: default);
Expand All @@ -53,6 +55,7 @@ public async Task StartAsync_Twice_ThrowTestAsync()
{
PrivateKey = privateKey.ToString(),
EndPoint = endPoint.ToString(),
AppProtocolVersion = privateKey.ToAppProtocolVersion(0).Token,
};
await using var seed = new Seed(options);
await seed.StartAsync(cancellationToken: default);
Expand All @@ -71,6 +74,7 @@ public async Task StopAsync_TestAsync()
{
PrivateKey = privateKey.ToString(),
EndPoint = endPoint.ToString(),
AppProtocolVersion = privateKey.ToAppProtocolVersion(0).Token,
};
await using var seed = new Seed(options);
await seed.StartAsync(cancellationToken: default);
Expand All @@ -87,6 +91,7 @@ public async Task StopAsync_NotRunning_ThrowTestAsync()
{
PrivateKey = privateKey.ToString(),
EndPoint = endPoint.ToString(),
AppProtocolVersion = privateKey.ToAppProtocolVersion(0).Token,
};
await using var seed = new Seed(options);
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
Expand Down Expand Up @@ -118,6 +123,7 @@ public async Task MessageReceived_TestAsync()
{
PrivateKey = seedPrivateKey.ToString(),
EndPoint = seedEndPoint.ToString(),
AppProtocolVersion = apv.Token,
};
await using var seed = new Seed(options);
await seed.StartAsync(cancellationToken: default);
Expand Down Expand Up @@ -177,6 +183,7 @@ public async Task GetNeighborsMsg_TestAsync()
{
PrivateKey = seedPrivateKey.ToString(),
EndPoint = seedEndPoint.ToString(),
AppProtocolVersion = apv.Token,
};
await using var seed = new Seed(options);
await seed.StartAsync(cancellationToken: default);
Expand Down

2 comments on commit 3b09aa8

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Benchmark.Net Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 3b09aa8 Previous: 652ba8f Ratio
Libplanet.Benchmarks.Store.GetRecentTxOutOfManyTxs 5812.0360824742265 ns (± 905.7165103507791) 2585.3333333333335 ns (± 171.028262771586) 2.25

This comment was automatically generated by workflow using github-action-benchmark.

CC: @libplanet

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Benchmark.Net Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 3b09aa8 Previous: 652ba8f Ratio
Libplanet.Benchmarks.Store.GetRecentTxOutOfManyTxs 4506.18556701031 ns (± 880.2005492345777) 2231.958762886598 ns (± 365.5892480390895) 2.02

This comment was automatically generated by workflow using github-action-benchmark.

CC: @libplanet

Please sign in to comment.