diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 5f22ace07..4642c0d3e 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -120,4 +120,4 @@ jobs: uses: actions/upload-artifact@v2 with: name: test-logs - path: duplicati_testdata/logs/logfile.log \ No newline at end of file + path: duplicati_testdata/logs/* \ No newline at end of file diff --git a/Duplicati/UnitTest/BasicSetupHelper.cs b/Duplicati/UnitTest/BasicSetupHelper.cs index 01703b486..12503c508 100644 --- a/Duplicati/UnitTest/BasicSetupHelper.cs +++ b/Duplicati/UnitTest/BasicSetupHelper.cs @@ -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 TestOptions