[#33] Client: Add extended life tests
Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
2e56c13946
commit
bd8eb7cc60
24 changed files with 1020 additions and 976 deletions
111
src/FrostFS.SDK.Tests/Smoke/Client/NetworkTests/NetworkTests.cs
Normal file
111
src/FrostFS.SDK.Tests/Smoke/Client/NetworkTests/NetworkTests.cs
Normal file
|
@ -0,0 +1,111 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using FrostFS.SDK.Client;
|
||||
using FrostFS.SDK.SmokeTests;
|
||||
|
||||
namespace FrostFS.SDK.Tests.Smoke;
|
||||
|
||||
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task", Justification = "Default Value is correct for tests")]
|
||||
[SuppressMessage("Security", "CA5394:Do not use insecure randomness", Justification = "No secure purpose")]
|
||||
public class SmokeClientTests : SmokeTestsBase
|
||||
{
|
||||
[Fact]
|
||||
public async void AccountTest()
|
||||
{
|
||||
var test = lightWait.Timeout;
|
||||
|
||||
var client = FrostFSClient.GetInstance(ClientOptions, GrpcChannel);
|
||||
|
||||
var result = await client.GetBalanceAsync(default);
|
||||
|
||||
Assert.NotNull(result);
|
||||
Assert.True(result.Value == 0);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void NodeInfoTest()
|
||||
{
|
||||
var client = FrostFSClient.GetInstance(ClientOptions, GrpcChannel);
|
||||
|
||||
var result = await client.GetNodeInfoAsync(default);
|
||||
|
||||
Assert.Equal(2, result.Version.Major);
|
||||
Assert.Equal(13, result.Version.Minor);
|
||||
Assert.Equal(NodeState.Online, result.State);
|
||||
Assert.Equal(33, result.PublicKey.Length);
|
||||
Assert.Equal(2, result.Addresses.Count);
|
||||
Assert.Equal(11, result.Attributes.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void NodeInfoStatisticsTest()
|
||||
{
|
||||
var options = ClientOptions;
|
||||
|
||||
var callbackContent = string.Empty;
|
||||
options.Value.Callback = (cs) => callbackContent = $"{cs.MethodName} took {cs.ElapsedMicroSeconds} microseconds";
|
||||
|
||||
var client = FrostFSClient.GetInstance(options, GrpcChannel);
|
||||
|
||||
var result = await client.GetNodeInfoAsync(default);
|
||||
|
||||
Assert.NotEmpty(callbackContent);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void NetworkSettingsTest()
|
||||
{
|
||||
var options = ClientOptions;
|
||||
var client = FrostFSClient.GetInstance(options, GrpcChannel);
|
||||
|
||||
var result = await client.GetNetworkSettingsAsync(default);
|
||||
|
||||
Assert.NotNull(result);
|
||||
|
||||
Assert.True(0u < result.Epoch);
|
||||
Assert.True(result.HomomorphicHashingDisabled);
|
||||
Assert.True(result.MaintenanceModeAllowed);
|
||||
Assert.True(0u < result.MagicNumber);
|
||||
|
||||
Assert.Equal(0u, result.AuditFee);
|
||||
Assert.Equal(0u, result.BasicIncomeRate);
|
||||
Assert.Equal(0u, result.ContainerAliasFee);
|
||||
Assert.Equal(0u, result.ContainerFee);
|
||||
Assert.Equal(75u, result.EpochDuration);
|
||||
Assert.Equal(10_000_000_000u, result.InnerRingCandidateFee);
|
||||
Assert.Equal(12u, result.MaxECDataCount);
|
||||
Assert.Equal(4u, result.MaxECParityCount);
|
||||
Assert.Equal(5242880u, result.MaxObjectSize);
|
||||
Assert.Equal(8000u, result.MsPerBlock);
|
||||
Assert.Equal(100_000_000u, result.WithdrawFee);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async void NodeInfoCallbackAndInterceptorTest()
|
||||
{
|
||||
bool callbackInvoked = false;
|
||||
bool interceptorInvoked = false;
|
||||
|
||||
var options = ClientOptions;
|
||||
options.Value.Callback = (cs) =>
|
||||
{
|
||||
callbackInvoked = true;
|
||||
Assert.True(cs.ElapsedMicroSeconds > 0);
|
||||
};
|
||||
|
||||
options.Value.Interceptors.Add(new CallbackInterceptor(s => interceptorInvoked = true));
|
||||
|
||||
var client = FrostFSClient.GetInstance(options, GrpcChannel);
|
||||
|
||||
var result = await client.GetNodeInfoAsync(default);
|
||||
|
||||
Assert.True(callbackInvoked);
|
||||
Assert.True(interceptorInvoked);
|
||||
|
||||
Assert.Equal(2, result.Version.Major);
|
||||
Assert.Equal(13, result.Version.Minor);
|
||||
Assert.Equal(NodeState.Online, result.State);
|
||||
Assert.Equal(33, result.PublicKey.Length);
|
||||
Assert.NotNull(result.Addresses);
|
||||
Assert.True(result.Attributes.Count > 0);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue