More logging in tests

This commit is contained in:
Thomas Suckow
2022-05-06 21:46:17 -07:00
parent 5956b771f0
commit 3172ec3a4b
8 changed files with 26 additions and 26 deletions
+3 -3
View File
@@ -104,7 +104,7 @@ namespace Duplicati.UnitTest
timer.Elapsed += delegate(object obj, ElapsedEventArgs e){
var nogc = GC.GetTotalMemory(false)/1000/1000;
var yesgc = GC.GetTotalMemory(true)/1000/1000;
TestContext.Progress.WriteLine("Memory: {0} -> {1}", nogc, yesgc);
TestContext.Progress.WriteLine("Memory: {0}MB -> {1}MB", nogc, yesgc);
};
timer.AutoReset = true;
return timer;
@@ -115,7 +115,7 @@ namespace Duplicati.UnitTest
public void BasicHelperSetUp()
{
memoryTimer.Enabled = true;
TestContext.Progress.WriteLine("Setup {0}", TestContext.CurrentContext.Test.Name);
TestContext.Progress.WriteLine("Setup {0} {1}MB", TestContext.CurrentContext.Test.Name, GC.GetTotalMemory(true)/1000/1000);
systemIO.DirectoryCreate(this.DATAFOLDER);
systemIO.DirectoryCreate(this.TARGETFOLDER);
systemIO.DirectoryCreate(this.RESTOREFOLDER);
@@ -126,7 +126,7 @@ namespace Duplicati.UnitTest
{
memoryTimer.Enabled = false;
if( TestContext.CurrentContext.Test.MethodName != null){
TestContext.Progress.WriteLine("TearDown {0} {1}", TestContext.CurrentContext.Test.MethodName, GC.GetTotalMemory(true)/1000/1000);
TestContext.Progress.WriteLine("TearDown {0} {1}MB", TestContext.CurrentContext.Test.MethodName, GC.GetTotalMemory(true)/1000/1000);
}
if (systemIO.DirectoryExists(this.DATAFOLDER))
{
+1 -1
View File
@@ -23,7 +23,7 @@ using NUnit.Framework;
namespace Duplicati.UnitTest
{
[Category("Compression")]
public class CompressionTests
public class CompressionTests : BasicSetupHelper
{
[TestCase("zip")]
[TestCase("7z")]
+1 -1
View File
@@ -9,7 +9,7 @@ using NUnit.Framework;
namespace Duplicati.UnitTest
{
public class DeleteHandlerTests
public class DeleteHandlerTests : BasicSetupHelper
{
private class Fileset : IListResultFileset, IEquatable<Fileset>
{
+11 -11
View File
@@ -20,21 +20,21 @@ using NUnit.Framework;
using Duplicati.Library.Common.IO;
using Duplicati.Library.Utility;
using Duplicati.Library.Common;
using Duplicati.Library.Common;
using System.Collections.Generic;
namespace Duplicati.UnitTest
namespace Duplicati.UnitTest
{
[Category("IO")]
public class IOTests
public class IOTests : BasicSetupHelper
{
public static string LongPath(string pathRoot)
public static string LongPath(string pathRoot)
{
string subFolder = "test";
return pathRoot + new StringBuilder().Insert(0, subFolder + Util.DirectorySeparatorString, 100);
}
[Test]
public void TestGetPathRootWithLongPath()
{
@@ -45,7 +45,7 @@ namespace Duplicati.UnitTest
}
[Test]
public void TestUncBehaviourOfGetPathRoot()
public void TestUncBehaviourOfGetPathRoot()
{
if (!Platform.IsClientWindows)
{
@@ -88,7 +88,7 @@ namespace Duplicati.UnitTest
var pathRoot = Platform.IsClientWindows ? "C:\\" : "/";
var longPath = LongPath(pathRoot);
if (SystemIO.IO_OS.DirectoryExists(longPath))
if (SystemIO.IO_OS.DirectoryExists(longPath))
{
return;
}
@@ -96,9 +96,9 @@ namespace Duplicati.UnitTest
//In particular don't throw PathTooLongException
Assert.Throws<System.IO.DirectoryNotFoundException>(() => SystemIO.IO_OS.GetDirectories(longPath));
}
[Test]
public void TestAddExtendedDevicePathPrefixInWindowsClient()
public void TestAddExtendedDevicePathPrefixInWindowsClient()
{
if (!Platform.IsClientWindows)
{
@@ -206,7 +206,7 @@ namespace Duplicati.UnitTest
}
[Test]
public void TestPathGetFullPathInWindowsClient()
public void TestPathGetFullPathInWindowsClient()
{
if (!Platform.IsClientWindows)
{
@@ -277,7 +277,7 @@ namespace Duplicati.UnitTest
};
foreach (var path in testCasesWherePathGetFullGivesSameResultsAsDotNet)
{
var actual = SystemIO.IO_WIN.PathGetFullPath(path);
var actual = SystemIO.IO_WIN.PathGetFullPath(path);
var expected = System.IO.Path.GetFullPath(path);
Assert.AreEqual(expected, actual, $"Path: {path}");
}
+1 -1
View File
@@ -29,7 +29,7 @@ using Backup = Duplicati.Server.Database.Backup;
namespace Duplicati.UnitTest
{
public class ImportExportTests
public class ImportExportTests : BasicSetupHelper
{
private string serverDatafolder;
@@ -5,7 +5,7 @@ using NUnit.Framework;
namespace Duplicati.UnitTest
{
[TestFixture]
public class ResultFormatSerializerProviderTest
public class ResultFormatSerializerProviderTest : BasicSetupHelper
{
[Test]
[Category("Serialization")]
+7 -7
View File
@@ -17,11 +17,11 @@
using NUnit.Framework;
using System.Collections.Specialized;
namespace Duplicati.UnitTest
{
public class UriUtilityTests
{
namespace Duplicati.UnitTest
{
public class UriUtilityTests : BasicSetupHelper
{
[Test]
[Category("UriUtility")]
public static void TestBuildUriQuery()
@@ -65,5 +65,5 @@ namespace Duplicati.UnitTest
Assert.AreEqual("/a", Library.Utility.UrlPath.Create(path1).Append(null).ToString());
Assert.AreEqual("/b/", Library.Utility.UrlPath.Create(string.Empty).Append(path2).ToString());
}
}
}
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ using System.Threading.Tasks;
namespace Duplicati.UnitTest
{
public class UtilityTests
public class UtilityTests : BasicSetupHelper
{
[Test]
[Category("Utility")]