Move download of test data to setup method.
This allows one to more easily run the unit tests locally.
This commit is contained in:
+1
-1
@@ -28,7 +28,7 @@ test_script:
|
||||
.\packages\OpenCover.4.6.166\tools\OpenCover.Console.exe `
|
||||
-register:user `
|
||||
-target:.\packages\NUnit.ConsoleRunner.3.4.0\tools\nunit3-console.exe `
|
||||
"-targetargs:""$elem"" /framework:net-4.5 /where:cat!=BulkData /result:""$testResultsFile""" `
|
||||
"-targetargs:""$elem"" /framework:net-4.5 /result:""$testResultsFile""" `
|
||||
"-filter:+[Duplicati.Library.Main]* -[UnitTest]*" `
|
||||
-output:opencover.xml `
|
||||
-returntargetcode `
|
||||
|
||||
@@ -19,6 +19,7 @@ using NUnit.Framework;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
||||
namespace Duplicati.UnitTest
|
||||
{
|
||||
@@ -44,6 +45,20 @@ namespace Duplicati.UnitTest
|
||||
}
|
||||
}
|
||||
|
||||
public override void PrepareSourceData()
|
||||
{
|
||||
base.PrepareSourceData();
|
||||
|
||||
const string filename = "data.zip";
|
||||
string tempZipFile = Path.Combine(BASEFOLDER, filename);
|
||||
using (WebClient client = new WebClient())
|
||||
{
|
||||
client.DownloadFile($"https://s3.amazonaws.com/duplicati-test-file-hosting/{filename}", tempZipFile);
|
||||
}
|
||||
|
||||
System.IO.Compression.ZipFile.ExtractToDirectory(tempZipFile, BASEFOLDER);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("BulkData")]
|
||||
[Category("BulkNormal")]
|
||||
|
||||
@@ -32,32 +32,9 @@ msbuild /p:Configuration=Release Duplicati.sln
|
||||
cp -r ./Duplicati/Server/webroot ./Duplicati/GUI/Duplicati.GUI.TrayIcon/bin/Release/webroot
|
||||
echo "travis_fold:end:build_duplicati"
|
||||
|
||||
# download and extract testdata
|
||||
echo "travis_fold:start:download_extract_testdata"
|
||||
list_dir .
|
||||
|
||||
if [ ! -d ~/tmp ]; then mkdir ~/tmp; fi
|
||||
if [ ! -d ~/download ]; then mkdir ~/download; fi
|
||||
if [ ! -d ~/download/bulk ]; then mkdir ~/download/bulk; fi
|
||||
|
||||
if [ "$CATEGORY" == "BulkNormal" ] || [ "$CATEGORY" == "BulkNoSize" ]; then
|
||||
# test if zip file exists and contains no errors
|
||||
unzip -t ~/download/bulk/data.zip &> /dev/null || \
|
||||
wget --progress=dot:giga "https://s3.amazonaws.com/duplicati-test-file-hosting/data.zip" -O ~/download/bulk/data.zip
|
||||
list_dir ~/download/bulk
|
||||
fi
|
||||
|
||||
rm -rf ~/duplicati_testdata && mkdir ~/duplicati_testdata
|
||||
|
||||
if [ "$CATEGORY" == "BulkNormal" ] || [ "$CATEGORY" == "BulkNoSize" ]; then
|
||||
mkdir ~/duplicati_testdata/data
|
||||
unzip -q ~/download/bulk/data.zip -d ~/duplicati_testdata/
|
||||
list_dir ~/duplicati_testdata/data
|
||||
fi
|
||||
|
||||
chown -R $TESTUSER ~/duplicati_testdata/
|
||||
chmod -R 755 ~/duplicati_testdata
|
||||
echo "travis_fold:end:download_extract_testdata"
|
||||
|
||||
# run unit tests
|
||||
echo "travis_fold:start:unit_test"
|
||||
|
||||
Reference in New Issue
Block a user