Skip to content

Commit

Permalink
Test SqlServer test on Ubuntu in helix (#23177)
Browse files Browse the repository at this point in the history
Resolves #19974
Resolves #20128
  • Loading branch information
smitpatel committed Dec 15, 2020
1 parent 935b8de commit 7582807
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
5 changes: 3 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ stages:
value: $(_BuildConfig)
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- name: HelixTargetQueues
value: Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open
value: Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open;Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-sqlserver-amd64-20201109180804-3069967
- name: _HelixAccessToken
value: '' # Needed for public queues
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- name: HelixTargetQueues
value: Windows.10.Amd64;Ubuntu.1804.Amd64;OSX.1014.Amd64
value: Windows.10.Amd64;Ubuntu.1804.Amd64;OSX.1014.Amd64;Ubuntu.1604.Amd64@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-sqlserver-amd64-20201109180804-3069967
- name: _HelixAccessToken
value: $(HelixApiAccessToken) # Needed for internal queues
steps:
Expand All @@ -221,6 +221,7 @@ stages:
env:
HelixAccessToken: $(_HelixAccessToken)
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
MSSQL_SA_PASSWORD: "Password12!"

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: eng\common\templates\post-build\post-build.yml
Expand Down
22 changes: 15 additions & 7 deletions eng/helix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
<FailOnTestFailure>true</FailOnTestFailure>
<EnableXUnitReporter>true</EnableXUnitReporter>
<FailOnMissionControlTestFailure>true</FailOnMissionControlTestFailure>
<SqlServerTests>$(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj</SqlServerTests>
</PropertyGroup>

<PropertyGroup Condition = "'$(SYSTEM_ACCESSTOKEN)' == ''">
<!-- Local build outside of Azure Pipeline -->
<HelixTargetQueues Condition = "'$(HelixTargetQueues)' == ''">Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open</HelixTargetQueues>
<HelixTargetQueues Condition = "'$(HelixTargetQueues)' == ''">Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open;Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-sqlserver-amd64-20201109180804-3069967</HelixTargetQueues>
<EnableAzurePipelinesReporter>false</EnableAzurePipelinesReporter>
<FailOnMissionControlTestFailure>false</FailOnMissionControlTestFailure>
<HelixSource>efcore/localbuild/</HelixSource>
Expand All @@ -33,17 +34,24 @@

<!-- Start LocalDb instance for test projects which uses SqlServer on windows -->
<ItemGroup Condition = "'$(HelixTargetQueue.StartsWith(`Windows`))'">
<XUnitProject Update="$(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj">
<XUnitProject Update="$(SqlServerTests);$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj">
<PreCommands>$(PreCommands); SqlLocalDB start</PreCommands>
</XUnitProject>
<XUnitProject Update="$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj">
<PreCommands>$(PreCommands); SqlLocalDB start</PreCommands>
</XUnitProject>
<XUnitProject Update="$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj">
<PreCommands>$(PreCommands); SqlLocalDB start</PreCommands>
</ItemGroup>

<!-- Start SqlServer instance for test projects which uses SqlServer on docker. Also remove other projects as they will be run outside of docker. -->
<ItemGroup Condition = "'$(HelixTargetQueue.Contains(`ubuntu-18.04-helix-sqlserver-amd64`))'">
<XUnitProject Remove="$(RepoRoot)/test/**/*.csproj"/>
<XUnitProject Include="$(SqlServerTests);$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj">
<PreCommands>$(PreCommands); export MSSQL_SA_PASSWORD=$(MSSQL_SA_PASSWORD); /opt/mssql/bin/sqlservr --accept-eula &amp;; export Test__SqlServer__DefaultConnection="Data Source=localhost;;Database=master;;User=sa;;Password=$(MSSQL_SA_PASSWORD);;Connect Timeout=60;;ConnectRetryCount=0"; sleep 120</PreCommands>
</XUnitProject>
</ItemGroup>

<!-- Remove test projects which requires SqlServer from Ubuntu/OSX. -->
<ItemGroup Condition = "'$(HelixTargetQueue.StartsWith(`OSX`))' OR '$(HelixTargetQueue)' == 'Ubuntu.1804.Amd64.Open' OR '$(HelixTargetQueue)' == 'Ubuntu.1804.Amd64'">
<XUnitProject Remove="$(SqlServerTests)"/>
</ItemGroup>

<PropertyGroup>
<XUnitPublishTargetFramework>net5.0</XUnitPublishTargetFramework>
<XUnitRuntimeTargetFramework>netcoreapp2.0</XUnitRuntimeTargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public override async Task<string> FromSqlRaw_queryable_composed(bool async)
WHERE [c].[ContactName] LIKE N'%z%'";

AssertSql(expected);
Assert.Equal(expected, queryString);
Assert.Equal(expected, queryString, ignoreLineEndingDifferences: true);

return null;
}
Expand Down Expand Up @@ -355,7 +355,7 @@ public override async Task<string> FromSqlRaw_queryable_with_parameters_and_clos
FROM (
SELECT * FROM ""Customers"" WHERE ""City"" = @p0
) AS [c]
WHERE [c].[ContactTitle] = @__contactTitle_1", queryString);
WHERE [c].[ContactTitle] = @__contactTitle_1", queryString, ignoreLineEndingDifferences: true);

return null;
}
Expand Down

0 comments on commit 7582807

Please sign in to comment.