Try gzipping the logs

This commit is contained in:
Thomas Suckow
2022-03-14 21:07:07 -07:00
parent 20214f6c00
commit 71faeb9a0e
2 changed files with 16 additions and 6 deletions
+1 -1
View File
@@ -120,4 +120,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: test-logs
path: duplicati_testdata/logs/logfile.log
path: duplicati_testdata/logs/*
+15 -5
View File
@@ -98,16 +98,14 @@ namespace Duplicati.UnitTest
// No-op by default.
}
private static int count = 1;
[SetUp]
public virtual void SetUp()
{
systemIO.DirectoryCreate(this.DATAFOLDER);
systemIO.DirectoryCreate(this.TARGETFOLDER);
systemIO.DirectoryCreate(this.RESTOREFOLDER);
if (systemIO.FileExists(this.LOGFILE))
{
systemIO.FileDelete(this.LOGFILE);
}
systemIO.DirectoryCreate(this.RESTOREFOLDER);
}
[TearDown]
@@ -133,6 +131,18 @@ namespace Duplicati.UnitTest
{
systemIO.FileDelete($"{this.DBFILE}-journal");
}
if (systemIO.FileExists(this.LOGFILE))
{
var source = new System.IO.FileStream(this.LOGFILE, System.IO.FileMode.Open, System.IO.FileAccess.Read);
var dest = new System.IO.FileStream($"{this.LOGFILE}.{count++}.gz", System.IO.FileMode.Create, System.IO.FileAccess.Write);
var gzip = new System.IO.Compression.GZipStream(dest, System.IO.Compression.CompressionMode.Compress);
source.CopyTo(gzip);
gzip.Flush();
source.Close();
gzip.Close();
dest.Close();
systemIO.FileDelete(this.LOGFILE);
}
}
protected virtual Dictionary<string, string> TestOptions