diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml
index fbfd42f40969..0e63e13a4f1b 100644
--- a/.azure/pipelines/ci.yml
+++ b/.azure/pipelines/ci.yml
@@ -300,6 +300,9 @@ jobs:
- powershell: "& ./.azure/pipelines/tools/SetupTestEnvironment.ps1 Setup signalrclienttests.exe"
displayName: Start AppVerifier
afterBuild:
+ - powershell: "& ./build.ps1 -CI -NoBuild -Test /p:RunFlakyTests=true"
+ displayName: Run Flaky Tests
+ continueOnError: true
- powershell: "& ./.azure/pipelines/tools/SetupTestEnvironment.ps1 Shutdown signalrclienttests.exe"
displayName: Stop AppVerifier
condition: always()
@@ -307,6 +310,7 @@ jobs:
- name: Windows_Test_Logs
path: artifacts/logs/
publishOnError: true
+
- template: jobs/default-build.yml
parameters:
condition: ne(variables['SkipTests'], 'true')
@@ -318,6 +322,10 @@ jobs:
beforeBuild:
- bash: "./eng/scripts/install-nginx-mac.sh"
displayName: Installing Nginx
+ afterBuild:
+ - bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true
+ displayName: Run Flaky Tests
+ continueOnError: true
artifacts:
- name: MacOS_Test_Logs
path: artifacts/logs/
@@ -333,6 +341,10 @@ jobs:
beforeBuild:
- bash: "./eng/scripts/install-nginx-linux.sh"
displayName: Installing Nginx
+ afterBuild:
+ - bash: ./build.sh --no-build --ci --test -p:RunFlakyTests=true
+ displayName: Run Flaky Tests
+ continueOnError: true
artifacts:
- name: Linux_Test_Logs
path: artifacts/logs/
diff --git a/.azure/pipelines/jobs/default-build.yml b/.azure/pipelines/jobs/default-build.yml
index c503d5c5aa4f..d2d8c6e055ec 100644
--- a/.azure/pipelines/jobs/default-build.yml
+++ b/.azure/pipelines/jobs/default-build.yml
@@ -174,6 +174,8 @@ jobs:
testRunner: vstest
testResultsFiles: '**/artifacts/**/*.trx'
mergeTestResults: true
+ buildConfiguration: $(BuildConfiguration)
+ buildPlatform: $(AgentOsName)
- ${{ each artifact in parameters.artifacts }}:
- task: PublishBuildArtifacts@1
displayName: Upload artifacts from ${{ artifact.path }}
diff --git a/eng/FlakyTests.AfterArcade.props b/eng/FlakyTests.AfterArcade.props
new file mode 100644
index 000000000000..12f631127e8b
--- /dev/null
+++ b/eng/FlakyTests.AfterArcade.props
@@ -0,0 +1,7 @@
+
+
+
+ $(ArtifactsDir)log\$(Configuration)\Flaky\
+ $(ArtifactsDir)TestResults\$(Configuration)\Flaky\
+
+
diff --git a/eng/FlakyTests.BeforeArcade.props b/eng/FlakyTests.BeforeArcade.props
new file mode 100644
index 000000000000..1cd94cc9cd8f
--- /dev/null
+++ b/eng/FlakyTests.BeforeArcade.props
@@ -0,0 +1,18 @@
+
+
+
+ <_FlakyRunAdditionalArgs>-trait "Flaky:All=true"
+ <_NonFlakyRunAdditionalArgs>-notrait "Flaky:All=true"
+
+
+
+
+ <_FlakyRunAdditionalArgs>$(_FlakyRunAdditionalArgs) -trait "Flaky:AzP:All=true" -trait "Flaky:AzP:OS:$(AGENT_OS)=true"
+ <_NonFlakyRunAdditionalArgs>$(_NonFlakyRunAdditionalArgs) -notrait "Flaky:AzP:All=true" -notrait "Flaky:AzP:OS:$(AGENT_OS)=true"
+
+
+
+ $(_NonFlakyRunAdditionalArgs)
+ $(_FlakyRunAdditionalArgs)
+
+
diff --git a/eng/helix/vstest/runtests.cmd b/eng/helix/vstest/runtests.cmd
index 91afad321040..802297f4a87b 100644
--- a/eng/helix/vstest/runtests.cmd
+++ b/eng/helix/vstest/runtests.cmd
@@ -1,3 +1,6 @@
+REM Disable "!Foo!" expansions because they break the filter syntax
+setlocal disableextensions
+
set target=%1
set sdkVersion=%2
set runtimeVersion=%3
@@ -18,12 +21,35 @@ set HELIX=%helixQueue%
%DOTNET_ROOT%\dotnet vstest %target% -lt >discovered.txt
find /c "Exception thrown" discovered.txt
-if %errorlevel% equ 0 (
- echo Exception thrown during test discovery.
- type discovered.txt
+REM "ERRORLEVEL is not %ERRORLEVEL%" https://blogs.msdn.microsoft.com/oldnewthing/20080926-00/?p=20743/
+if not errorlevel 1 (
+ echo Exception thrown during test discovery. 1>&2
+ type discovered.txt 1>&2
exit 1
)
-%DOTNET_ROOT%\dotnet vstest %target% --logger:trx --logger:console;verbosity=normal
+set exit_code=0
+
+REM Run non-flaky tests first
+REM We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
+REM only puts the explicit filter traits the user provided in
+REM Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md
+set NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true"
+echo Running non-flaky tests.
+%DOTNET_ROOT%\dotnet vstest %target% --logger:trx --logger:console;verbosity=normal --TestCaseFilter:%NONFLAKY_FILTER%
+if errorlevel 1 (
+ echo Failure in non-flaky test 1>&2
+ set exit_code=1
+ REM DO NOT EXIT
+)
+
+set FLAKY_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:%HELIX%=true"
+echo Running known-flaky tests.
+%DOTNET_ROOT%\dotnet vstest %target% --logger:trx --logger:console;verbosity=normal --TestCaseFilter:%FLAKY_FILTER%
+if errorlevel 1 (
+ echo Failure in flaky test 1>&2
+ REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1
+)
+exit %exit_code%
diff --git a/eng/helix/vstest/runtests.sh b/eng/helix/vstest/runtests.sh
index 776db87fe907..b7b9b812d7aa 100644
--- a/eng/helix/vstest/runtests.sh
+++ b/eng/helix/vstest/runtests.sh
@@ -67,4 +67,25 @@ if grep -q "Exception thrown" discovered.txt; then
exit 1
fi
-$DOTNET_ROOT/dotnet vstest $1 --logger:trx
+# Run non-flaky tests first
+# We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
+# only puts the explicit filter traits the user provided in the flaky attribute
+# Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md
+NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:$HELIX!=true"
+echo "Running non-flaky tests."
+$DOTNET_ROOT/dotnet vstest $1 --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER"
+nonflaky_exitcode=$?
+if [ $nonflaky_exitcode != 0 ]; then
+ echo "Non-flaky tests failed!" 1>&2
+ # DO NOT EXIT
+fi
+
+FLAKY_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:$HELIX=true"
+echo "Running known-flaky tests."
+$DOTNET_ROOT/dotnet vstest $1 --logger:trx --TestCaseFilter:"$FLAKY_FILTER"
+if [ $? != 0 ]; then
+ echo "Flaky tests failed!" 1>&2
+ # DO NOT EXIT
+fi
+
+exit $nonflaky_exitcode
diff --git a/korebuild-lock.txt b/korebuild-lock.txt
index 9631a5e67078..c8758ef040cb 100644
--- a/korebuild-lock.txt
+++ b/korebuild-lock.txt
@@ -1,2 +1,2 @@
-version:3.0.0-build-20190306.2
-commithash:18c06e0b774622c87560e6f21b97e099307fd10c
+version:3.0.0-build-20190314.2
+commithash:e3a8a2aae198f1ef26309714ccba6835be2437c3