Skip to content

Commit

Permalink
Add EF Core CI testing using Helix queues
Browse files Browse the repository at this point in the history
- Adds coverage for testing using
  - WindowsServer 2016-Datacenter with localdb
  - macOS 10.14
  - Ubuntu 18.04-LTS

- Currently tests are run separately based on OS type win/non-win due to #19964
- Uses anonymous auth from public build and access token from internal build
- Automatically adds all test projects from test folder
- All telemetry is enabled for reporting
  - EnableAzurePipelinesReporter
  - FailOnTestFailure
  - EnableXUnitReporter
  - FailOnMissionControlTestFailure
- Moved publishing of log inside each job as helix job does not produce any log
- Validated internal builds also uses helix for testing using HelixAccessToken
- Checking FullTextSearch on SqlServer has been put in try-catch (Helix run threw exception of localdb not found)


Resolves #19857
  • Loading branch information
smitpatel committed Feb 19, 2020
1 parent 1a73b7e commit 09e3d00
Show file tree
Hide file tree
Showing 5 changed files with 183 additions and 21 deletions.
135 changes: 131 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ variables:
- name: _CosmosToken
value: C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- group: DotNet-HelixApi-Access
- group: DotNet-MSRC-Storage
- name: _InternalRuntimeDownloadArgs
value: /p:DotNetRuntimeSourceFeed=https://dotnetclimsrc.blob.core.windows.net/dotnet
/p:DotNetRuntimeSourceFeedKey=$(dotnetclimsrc-read-sas-token-base64)
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: _InternalRuntimeDownloadArgs
value: ''

# used for post-build phases, internal builds only
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- group: DotNet-EFCore-SDLValidation-Params
Expand All @@ -41,14 +42,13 @@ stages:
- template: eng/common/templates/jobs/jobs.yml
parameters:
enableMicrobuild: true
enablePublishBuildArtifacts: true
enablePublishBuildAssets: true
enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }}
enablePublishTestResults: true
enableTelemetry: true
helixRepo: dotnet/efcore
jobs:
- job: Windows
enablePublishTestResults: true
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCorePublic-Pool
Expand Down Expand Up @@ -106,8 +106,17 @@ stages:
artifactName: packages
artifactType: Container
parallel: true
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
PublishLocation: Container
ArtifactName: $(Agent.Os)_$(Agent.JobName)
continueOnError: true
condition: always()

- job: macOS
enablePublishTestResults: true
pool:
vmImage: macOS-10.13
steps:
Expand All @@ -123,7 +132,7 @@ stages:
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- script: eng/common/cibuild.sh --configuration $(_BuildConfig) --binaryLog --prepareMachine $(_InternalRuntimeDownloadArgs)
- script: eng/common/cibuild.sh --configuration $(_BuildConfig) --prepareMachine $(_InternalRuntimeDownloadArgs)
env:
Test__Cosmos__DefaultConnection: $(_CosmosConnectionUrl)
name: Build
Expand All @@ -136,9 +145,18 @@ stages:
artifactName: $(Agent.Os)_$(Agent.JobName) TestResults
artifactType: Container
parallel: true
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
PublishLocation: Container
ArtifactName: $(Agent.Os)_$(Agent.JobName)
continueOnError: true
condition: always()

- job: Linux
timeoutInMinutes: 120
enablePublishTestResults: true
pool:
vmImage: ubuntu-16.04
variables:
Expand Down Expand Up @@ -181,6 +199,115 @@ stages:
artifactName: $(Agent.Os)_$(Agent.JobName) TestResults
artifactType: Container
parallel: true
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)'
PublishLocation: Container
ArtifactName: $(Agent.Os)_$(Agent.JobName)
continueOnError: true
condition: always()

- job: Helix_Windows
pool:
${{ if eq(variables['System.TeamProject'], 'public') }}:
name: NetCorePublic-Pool
queue: BuildPool.Windows.10.Amd64.VS2017.Open
${{ if ne(variables['System.TeamProject'], 'public') }}:
name: NetCoreInternal-Pool
queue: BuildPool.Windows.10.Amd64.VS2017
variables:
- name: _HelixBuildConfig
value: $(_BuildConfig)
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: HelixTargetQueues
value: Windows.10.Amd64.Open
- name: Creator
value: efcore
- ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: public/dotnet/efcore/$(Build.SourceBranch)
- ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: public/pr/dotnet/efcore/$(Build.SourceBranch)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- name: HelixTargetQueues
value: Windows.10.Amd64
- name: _HelixAccessToken
value: $(HelixApiAccessToken) # Needed for internal queues
- ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: official/dotnet/efcore/$(Build.SourceBranch)
- ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: official/pr/dotnet/efcore/$(Build.SourceBranch)
steps:
- task: NuGetCommand@2
displayName: 'Clear NuGet caches'
condition: succeeded()
inputs:
command: custom
arguments: 'locals all -clear'
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- script: restore.cmd -ci /p:configuration=$(_BuildConfig)
displayName: Restore packages
- script: .dotnet\dotnet msbuild eng\helix.proj /restore /t:Test /p:configuration=$(_BuildConfig)
displayName: Send job to helix
env:
HelixAccessToken: $(_HelixAccessToken)
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops

- job: Helix_Linux
pool:
vmImage: ubuntu-16.04
variables:
- name: _HelixBuildConfig
value: $(_BuildConfig)
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: HelixTargetQueues
value: Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open
- name: Creator
value: efcore
- ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: public/dotnet/efcore/$(Build.SourceBranch)
- ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: public/pr/dotnet/efcore/$(Build.SourceBranch)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- name: HelixTargetQueues
value: Ubuntu.1804.Amd64;OSX.1014.Amd64
- name: _HelixAccessToken
value: $(HelixApiAccessToken) # Needed for internal queues
- ${{ if notIn(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: official/dotnet/efcore/$(Build.SourceBranch)
- ${{ if in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'PullRequest') }}:
- name: _HelixSource
value: official/pr/dotnet/efcore/$(Build.SourceBranch)
steps:
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- script: ./restore.sh --restore -ci /p:configuration=$(_BuildConfig)
displayName: Restore packages
- script: .dotnet/dotnet msbuild eng/helix.proj /restore /t:Test /p:configuration=$(_BuildConfig)
displayName: Send job to helix
env:
HelixAccessToken: $(_HelixAccessToken)
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
Expand Down
32 changes: 32 additions & 0 deletions eng/helix.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test">
<PropertyGroup>
<HelixType>test/product/</HelixType>
<HelixBuild>$(BUILD_BUILDNUMBER)</HelixBuild>
<HelixTargetQueues>$(HelixTargetQueues)</HelixTargetQueues>
<Creator>$(Creator)</Creator>
<HelixAccessToken>$(HelixAccessToken)</HelixAccessToken>

<IncludeDotNetCli>true</IncludeDotNetCli>
<DotNetCliPackageType>sdk</DotNetCliPackageType>
<DotNetCliVersion>3.1.100</DotNetCliVersion>

<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
<FailOnTestFailure>true</FailOnTestFailure>
<EnableXUnitReporter>true</EnableXUnitReporter>
<FailOnMissionControlTestFailure>true</FailOnMissionControlTestFailure>
</PropertyGroup>

<ItemGroup>
<XUnitProject Include="$(RepoRoot)/test/**/*.csproj"/>
<XUnitProject Remove="$(RepoRoot)/test/EFCore.Specification.Tests/*.csproj"/>
<XUnitProject Remove="$(RepoRoot)/test/EFCore.Relational.Specification.Tests/*.csproj"/>
</ItemGroup>

<PropertyGroup>
<XUnitPublishTargetFramework>netcoreapp3.1</XUnitPublishTargetFramework>
<XUnitRuntimeTargetFramework>netcoreapp2.0</XUnitRuntimeTargetFramework>
<XUnitRunnerVersion>2.4.1</XUnitRunnerVersion>
<XUnitArguments></XUnitArguments>
<XUnitWorkItemTimeout>00:30:00</XUnitWorkItemTimeout>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"version": "3.1.100"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20116.1"
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20116.1",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20116.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@
<ProjectReference Include="..\EFCore.Specification.Tests\EFCore.Specification.Tests.csproj" />
</ItemGroup>

<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,32 @@ public static bool IsFullTestSearchSupported
return _fullTextInstalled.Value;
}

using (var sqlConnection = new SqlConnection(SqlServerTestStore.CreateConnectionString("master")))
try
{
sqlConnection.Open();

using var command = new SqlCommand(
"SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')", sqlConnection);
var result = (int)command.ExecuteScalar();
using (var sqlConnection = new SqlConnection(SqlServerTestStore.CreateConnectionString("master")))
{
sqlConnection.Open();

_fullTextInstalled = result == 1;
using var command = new SqlCommand(
"SELECT FULLTEXTSERVICEPROPERTY('IsFullTextInstalled')", sqlConnection);
var result = (int)command.ExecuteScalar();

if (_fullTextInstalled.Value)
{
var flag = GetFlag("SupportsFullTextSearch");
_fullTextInstalled = result == 1;

if (flag.HasValue)
if (_fullTextInstalled.Value)
{
return flag.Value;
var flag = GetFlag("SupportsFullTextSearch");

if (flag.HasValue)
{
return flag.Value;
}
}
}
}
catch (PlatformNotSupportedException)
{
}

_fullTextInstalled = false;
return false;
Expand Down

0 comments on commit 09e3d00

Please sign in to comment.