113 lines
3.7 KiB
C#
113 lines
3.7 KiB
C#
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.Single(result.Addresses);
|
|
Assert.Equal(9, result.Attributes.Count);
|
|
//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);
|
|
}
|
|
}
|