Moves projects into folders

This commit is contained in:
benbierens 2023-09-20 10:51:47 +02:00
parent df8ab6bcf5
commit 09670e00e9
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
194 changed files with 166 additions and 120 deletions

View File

@ -1,5 +1,4 @@
using Logging;
using NUnit.Framework;
using Utils;
namespace FileUtils
@ -106,12 +105,12 @@ namespace FileUtils
if (spaceAvailable < size.SizeInBytes)
{
var msg = $"Inconclusive: Not enough disk space to perform test. " +
var msg = $"Not enough disk space. " +
$"{Formatter.FormatByteSize(size.SizeInBytes)} required. " +
$"{Formatter.FormatByteSize(spaceAvailable)} available.";
log.Log(msg);
Assert.Inconclusive(msg);
throw new Exception(msg);
}
}

View File

@ -1,5 +1,4 @@
using Logging;
using NUnit.Framework;
using Utils;
namespace FileUtils
@ -40,10 +39,10 @@ namespace FileUtils
private void AssertEqual(TrackedFile? actual)
{
if (actual == null) Assert.Fail("TestFile is null.");
if (actual == this || actual!.Filename == Filename) Assert.Fail("TestFile is compared to itself.");
if (actual == null) FrameworkAssert.Fail("TestFile is null.");
if (actual == this || actual!.Filename == Filename) FrameworkAssert.Fail("TestFile is compared to itself.");
Assert.That(actual.GetFileSize(), Is.EqualTo(GetFileSize()), "Files are not of equal length.");
FrameworkAssert.That(actual.GetFileSize() == GetFileSize(), "Files are not of equal length.");
using var streamExpected = new FileStream(Filename, FileMode.Open, FileAccess.Read);
using var streamActual = new FileStream(actual.Filename, FileMode.Open, FileAccess.Read);
@ -65,11 +64,11 @@ namespace FileUtils
return;
}
Assert.That(readActual, Is.EqualTo(readExpected), "Unable to read buffers of equal length.");
FrameworkAssert.That(readActual == readExpected, "Unable to read buffers of equal length.");
for (var i = 0; i < readActual; i++)
{
if (bytesExpected[i] != bytesActual[i]) Assert.Fail("File contents not equal.");
if (bytesExpected[i] != bytesActual[i]) FrameworkAssert.Fail("File contents not equal.");
}
}
}

View File

@ -9,6 +9,7 @@
<ItemGroup>
<PackageReference Include="KubernetesClient" Version="10.1.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>

View File

@ -70,14 +70,6 @@ namespace Logging
return new LogFile($"{GetFullName()}_{GetSubfileNumber()}", ext);
}
public void WriteLogTag()
{
var runId = NameUtils.GetRunId();
var category = NameUtils.GetCategoryName();
var name = NameUtils.GetTestMethodName();
LogFile.WriteRaw($"{runId} {category} {name}");
}
private string ApplyReplacements(string str)
{
foreach (var replacement in replacements)

View File

@ -7,12 +7,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Utils\Utils.csproj" />
</ItemGroup>

View File

@ -1,8 +1,8 @@
namespace Logging
{
public class NullLog : TestLog
public class NullLog : BaseLog
{
public NullLog() : base("NULL", false, "NULL")
public NullLog() : base(false)
{
}

View File

@ -0,0 +1,15 @@
namespace Utils
{
public static class FrameworkAssert
{
public static void That(bool condition, string message)
{
if (!condition) Fail(message);
}
public static void Fail(string message)
{
throw new Exception(message);
}
}
}

View File

@ -4,7 +4,6 @@ using GethPlugin;
using KubernetesWorkflow;
using Logging;
using MetricsPlugin;
using NUnit.Framework;
using Utils;
namespace CodexPlugin
@ -91,8 +90,8 @@ namespace CodexPlugin
return CodexAccess.UploadFile(fileStream);
});
if (string.IsNullOrEmpty(response)) Assert.Fail("Received empty response.");
if (response.StartsWith(UploadFailedMessage)) Assert.Fail("Node failed to store block.");
if (string.IsNullOrEmpty(response)) FrameworkAssert.Fail("Received empty response.");
if (response.StartsWith(UploadFailedMessage)) FrameworkAssert.Fail("Node failed to store block.");
Log($"Uploaded file. Received contentId: '{response}'.");
return new ContentId(response);
@ -116,7 +115,7 @@ namespace CodexPlugin
var peerInfo = node.GetDebugInfo();
var response = CodexAccess.ConnectToPeer(peerInfo.id, GetPeerMultiAddress(peer, peerInfo));
Assert.That(response, Is.EqualTo(SuccessfullyConnectedMessage), "Unable to connect codex nodes.");
FrameworkAssert.That(response == SuccessfullyConnectedMessage, "Unable to connect codex nodes.");
Log($"Successfully connected to peer {peer.GetName()}.");
}

View File

@ -1,7 +1,6 @@
using CodexContractsPlugin;
using Logging;
using Newtonsoft.Json;
using NUnit.Framework;
using Utils;
using System.Numerics;
@ -113,7 +112,7 @@ namespace CodexPlugin
private void Unavailable()
{
Assert.Fail("Incorrect test setup: Marketplace was not enabled for this group of Codex nodes. Add 'EnableMarketplace(...)' after 'SetupCodexNodes()' to enable it.");
FrameworkAssert.Fail("Incorrect test setup: Marketplace was not enabled for this group of Codex nodes. Add 'EnableMarketplace(...)' after 'SetupCodexNodes()' to enable it.");
throw new InvalidOperationException();
}
}
@ -189,12 +188,12 @@ namespace CodexPlugin
if (lastState == "errored")
{
Assert.Fail("Contract errored: " + statusJson);
FrameworkAssert.Fail("Contract errored: " + statusJson);
}
if (DateTime.UtcNow - waitStart > timeout)
{
Assert.Fail($"Contract did not reach '{desiredState}' within timeout. {statusJson}");
FrameworkAssert.Fail($"Contract did not reach '{desiredState}' within timeout. {statusJson}");
}
}
log.Log($"Contract '{desiredState}'.");

Some files were not shown because too many files have changed in this diff Show More