From dd90dbfa2e59d7bfd0aa78f0449fd5e30e97747c Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 13 Jul 2020 23:37:14 -0400 Subject: [PATCH] fixup! automation tests mac/linux --- azure-pipelines.yml | 10 ++-- .../AutomationTest.cs | 6 ++- test.sh | 50 +++---------------- 3 files changed, 15 insertions(+), 51 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ee8bea45fa..5a0442d664 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -255,7 +255,7 @@ stages: inputs: targetType: 'filePath' filePath: '$(testsFolder)/test.sh' - arguments: '$(osName) Unit Test' + arguments: '$(osName) Unit' - publish: TestResult.xml artifact: 'TestResult' displayName: Publish Test Result @@ -337,7 +337,7 @@ stages: inputs: targetType: 'filePath' filePath: '$(testsFolder)/test.sh' - arguments: $(osName) Integration Test + arguments: $(osName) Integration - task: PublishTestResults@2 inputs: testResultsFormat: 'NUnit' @@ -394,9 +394,9 @@ stages: displayName: Move Package Contents - bash: | if [[ $OSNAME == "Mac" ]]; then - url=https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz + url=https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-macos.tar.gz elif [[ $OSNAME == "Linux" ]]; then - url=https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz + url=https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz else echo "Unhandled OS" exit 1 @@ -412,7 +412,7 @@ stages: inputs: targetType: 'filePath' filePath: '$(testsFolder)/test.sh' - arguments: $(osName) Automation Test + arguments: $(osName) Automation - task: PublishTestResults@2 inputs: testResultsFormat: 'NUnit' diff --git a/src/NzbDrone.Automation.Test/AutomationTest.cs b/src/NzbDrone.Automation.Test/AutomationTest.cs index 0e0fea564c..c9fe579b51 100644 --- a/src/NzbDrone.Automation.Test/AutomationTest.cs +++ b/src/NzbDrone.Automation.Test/AutomationTest.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using FluentAssertions; using NLog; @@ -34,7 +34,9 @@ public AutomationTest() [TestFixtureSetUp] public void SmokeTestSetup() { - driver = new FirefoxDriver(); + var options = new FirefoxOptions(); + options.AddArguments("--headless"); + driver = new FirefoxDriver(options); _runner = new NzbDroneRunner(LogManager.GetCurrentClassLogger()); _runner.KillAll(); diff --git a/test.sh b/test.sh index 4426984aac..25b4a8c355 100755 --- a/test.sh +++ b/test.sh @@ -2,21 +2,15 @@ PLATFORM=$1 TYPE=$2 WHERE="cat != ManualTest" +TEST_DIR="." TEST_PATTERN="*Test.dll" ASSEMBLIES="" TEST_LOG_FILE="TestLog.txt" -echo "test dir: $TEST_DIR" -if [ -z "$TEST_DIR" ]; then - TEST_DIR="." -fi - if [ -d "$TEST_DIR/_tests" ]; then TEST_DIR="$TEST_DIR/_tests" fi -COVERAGE_RESULT_DIRECTORY="$TEST_DIR/CoverageResults/" - rm -f "$TEST_LOG_FILE" # Uncomment to log test output to a file instead of the console @@ -26,44 +20,12 @@ NUNIT="$TEST_DIR/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe" NUNIT_COMMAND="$NUNIT" NUNIT_PARAMS="--workers=1" -if [ "$PLATFORM" = "Mac" ]; then - - #set up environment - if [[ -x '/opt/local/bin/mono' ]]; then - # Macports and mono-supplied installer path - export PATH="/opt/local/bin:$PATH" - elif [[ -x '/usr/local/bin/mono' ]]; then - # Homebrew-supplied path to mono - export PATH="/usr/local/bin:$PATH" - fi - - echo $TEST_DIR - export DYLD_FALLBACK_LIBRARY_PATH="$TEST_DIR" - - if [ -e /Library/Frameworks/Mono.framework ]; then - MONO_FRAMEWORK_PATH=/Library/Frameworks/Mono.framework/Versions/Current - export PATH="$MONO_FRAMEWORK_PATH/bin:$PATH" - export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$MONO_FRAMEWORK_PATH/lib" - fi - - if [[ -f '/opt/local/lib/libsqlite3.0.dylib' ]]; then - export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib:$DYLD_FALLBACK_LIBRARY_PATH" - fi - - export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$HOME/lib:/usr/local/lib:/lib:/usr/lib" - echo $LD_LIBRARY_PATH - echo $DYLD_LIBRARY_PATH - echo $DYLD_FALLBACK_LIBRARY_PATH - - # To debug which libraries are being loaded: - # export DYLD_PRINT_LIBRARIES=YES -fi - if [ "$PLATFORM" = "Windows" ]; then - mkdir -p "$ProgramData/Radarr" WHERE="$WHERE && cat != LINUX" -elif [ "$PLATFORM" = "Linux" ] || [ "$PLATFORM" = "Mac" ] ; then - mkdir -p ~/.config/Radarr +elif [ "$PLATFORM" = "Linux" ]; then + WHERE="$WHERE && cat != WINDOWS" + NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT" +elif [ "$PLATFORM" = "Mac" ]; then WHERE="$WHERE && cat != WINDOWS" NUNIT_COMMAND="mono --debug --runtime=v4.0 $NUNIT" else @@ -94,4 +56,4 @@ if [ "$EXIT_CODE" -ge 0 ]; then exit 0 else exit $EXIT_CODE -fi \ No newline at end of file +fi