Skip to content
代码片段 群组 项目
未验证 提交 e8363b1c 编辑于 作者: Hao Kung's avatar Hao Kung 提交者: GitHub
浏览文件

[Helix] Split flaky helix tests into separate yml (#18597)

上级 76b0dffb
No related branches found
No related tags found
无相关合并请求
# Don't run CI for this config yet. We're not ready to move official builds on to Azure Pipelines
trigger: none
# Run PR validation on all branches
pr:
branches:
include:
- '*'
jobs:
- template: jobs/default-build.yml
parameters:
jobName: Helix_quarantine_x64
jobDisplayName: 'Tests: Helix Quarantine x64'
agentOs: Windows
timeoutInMinutes: 240
steps:
- script: .\restore.cmd -ci
displayName: Restore
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:RunQuarantinedTests=true /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
displayName: Run build.cmd helix target
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
artifacts:
- name: Helix_logs
path: artifacts/log/
publishOnError: true
...@@ -8,6 +8,7 @@ set sdkVersion=%3 ...@@ -8,6 +8,7 @@ set sdkVersion=%3
set runtimeVersion=%4 set runtimeVersion=%4
set helixQueue=%5 set helixQueue=%5
set arch=%6 set arch=%6
set quarantined=%7
set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk set DOTNET_HOME=%HELIX_CORRELATION_PAYLOAD%\sdk
set DOTNET_ROOT=%DOTNET_HOME%\%arch% set DOTNET_ROOT=%DOTNET_HOME%\%arch%
...@@ -38,25 +39,25 @@ if not errorlevel 1 ( ...@@ -38,25 +39,25 @@ if not errorlevel 1 (
set exit_code=0 set exit_code=0
REM Run non-flaky tests first set NONQUARANTINE_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true"
REM We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute if (%quarantined%==true) (
REM only puts the explicit filter traits the user provided in echo Running all tests.
REM Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md %DOTNET_ROOT%\dotnet vstest %target% --logger:xunit
set NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:%HELIX%!=true" if errorlevel 1 (
echo Running non-flaky tests. echo Failure in flaky test 1>&2
%DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%NONFLAKY_FILTER% REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1
if errorlevel 1 ( )
echo Failure in non-flaky test 1>&2 ) else (
set exit_code=1 REM We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
REM DO NOT EXIT 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
echo Running non-quarantined tests.
set FLAKY_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:%HELIX%=true" %DOTNET_ROOT%\dotnet vstest %target% --logger:xunit --TestCaseFilter:%NONQUARANTINE_FILTER%
echo Running known-flaky tests. if errorlevel 1 (
%DOTNET_ROOT%\dotnet vstest %target% --TestCaseFilter:%FLAKY_FILTER% echo Failure in non-flaky test 1>&2
if errorlevel 1 ( set exit_code=1
echo Failure in flaky test 1>&2 REM DO NOT EXIT
REM DO NOT EXIT and DO NOT SET EXIT_CODE to 1 )
) )
echo "Copying TestResults\TestResults.xml to ." echo "Copying TestResults\TestResults.xml to ."
......
...@@ -4,6 +4,8 @@ test_binary_path="$1" ...@@ -4,6 +4,8 @@ test_binary_path="$1"
dotnet_sdk_version="$2" dotnet_sdk_version="$2"
dotnet_runtime_version="$3" dotnet_runtime_version="$3"
helix_queue_name="$4" helix_queue_name="$4"
target_arch="$5"
quarantined="$6"
RESET="\033[0m" RESET="\033[0m"
RED="\033[0;31m" RED="\033[0;31m"
...@@ -87,25 +89,27 @@ if grep -q "Exception thrown" discovered.txt; then ...@@ -87,25 +89,27 @@ if grep -q "Exception thrown" discovered.txt; then
exit 1 exit 1
fi fi
# Run non-flaky tests first exit_code=0
# We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
# We need to specify all possible quarantined filters that apply to this environment, because the quarantine attribute
# only puts the explicit filter traits the user provided in 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 # 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_queue_name!=true" NONQUARANTINE_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:$helix_queue_name!=true"
echo "Running non-flaky tests." if [ "$quarantined" == true ]; then
$DOTNET_ROOT/dotnet vstest $test_binary_path --logger:xunit --TestCaseFilter:"$NONFLAKY_FILTER" echo "Running all tests including quarantined."
nonflaky_exitcode=$? $DOTNET_ROOT/dotnet vstest $test_binary_path --logger:xunit
if [ $nonflaky_exitcode != 0 ]; then if [ $? != 0 ]; then
echo "Non-flaky tests failed!" 1>&2 echo "Quarantined tests failed!" 1>&2
# DO NOT EXIT # DO NOT EXIT
fi fi
else
FLAKY_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:$helix_queue_name=true" echo "Running non-quarantined tests."
echo "Running known-flaky tests." $DOTNET_ROOT/dotnet vstest $test_binary_path --logger:xunit --TestCaseFilter:"$NONQUARANTINE_FILTER"
$DOTNET_ROOT/dotnet vstest $test_binary_path --TestCaseFilter:"$FLAKY_FILTER" exit_code=$?
if [ $? != 0 ]; then if [ $exit_code != 0 ]; then
echo "Flaky tests failed!" 1>&2 echo "Non-quarantined tests failed!" 1>&2
# DO NOT EXIT # DO NOT EXIT
fi
fi fi
echo "Copying TestResults/TestResults to ." echo "Copying TestResults/TestResults to ."
...@@ -114,4 +118,4 @@ echo "Copying artifacts/logs to $HELIX_WORKITEM_UPLOAD_ROOT/../" ...@@ -114,4 +118,4 @@ echo "Copying artifacts/logs to $HELIX_WORKITEM_UPLOAD_ROOT/../"
shopt -s globstar shopt -s globstar
cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/../ cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/../
cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/ cp artifacts/log/**/*.log $HELIX_WORKITEM_UPLOAD_ROOT/
exit $nonflaky_exitcode exit $exit_code
...@@ -12,9 +12,12 @@ ...@@ -12,9 +12,12 @@
<PropertyGroup> <PropertyGroup>
<CreateHelixPayload>true</CreateHelixPayload> <CreateHelixPayload>true</CreateHelixPayload>
<HelixTimeout>00:30:00</HelixTimeout> <HelixTimeout>00:30:00</HelixTimeout>
<RunQuarantinedTests>false</RunQuarantinedTests>
<IsWindowsHelixQueue>false</IsWindowsHelixQueue> <IsWindowsHelixQueue>false</IsWindowsHelixQueue>
<IsWindowsHelixQueue Condition="$(HelixTargetQueue.Contains('Windows')) or $(HelixTargetQueue.Contains('windows'))">true</IsWindowsHelixQueue> <IsWindowsHelixQueue Condition="$(HelixTargetQueue.Contains('Windows')) or $(HelixTargetQueue.Contains('windows'))">true</IsWindowsHelixQueue>
<HelixTestName>$(MSBuildProjectName)-$(TargetFramework)</HelixTestName> <_HelixRunType Condition="'$(RunQuarantinedTests)' == 'true'">quarantined</_HelixRunType>
<_HelixRunType Condition="'$(RunQuarantinedTests)' != 'true'">unquarantined</_HelixRunType>
<HelixTestName>$(MSBuildProjectName)--$(TargetFramework)--$(_HelixRunType)</HelixTestName>
<HelixUseArchive>false</HelixUseArchive> <HelixUseArchive>false</HelixUseArchive>
<LoggingTestingDisableFileLogging Condition="'$(IsHelixJob)' == 'true'">false</LoggingTestingDisableFileLogging> <LoggingTestingDisableFileLogging Condition="'$(IsHelixJob)' == 'true'">false</LoggingTestingDisableFileLogging>
<NodeVersion>10.15.3</NodeVersion> <NodeVersion>10.15.3</NodeVersion>
......
...@@ -83,8 +83,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj ...@@ -83,8 +83,8 @@ Usage: dotnet msbuild /t:Helix src/MyTestProject.csproj
<TestAssembly>$(TargetFileName)</TestAssembly> <TestAssembly>$(TargetFileName)</TestAssembly>
<PreCommands>@(HelixPreCommand)</PreCommands> <PreCommands>@(HelixPreCommand)</PreCommands>
<PostCommands>@(HelixPostCommand)</PostCommands> <PostCommands>@(HelixPostCommand)</PostCommands>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture)</Command> <Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture)</Command> <Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppRuntimeVersion) $(_HelixFriendlyNameTargetQueue) $(TargetArchitecture) $(RunQuarantinedTests)</Command>
<Timeout>$(HelixTimeout)</Timeout> <Timeout>$(HelixTimeout)</Timeout>
</HelixWorkItem> </HelixWorkItem>
</ItemGroup> </ItemGroup>
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册