Skip to content

Commit 77a6fbd

Browse files
committed
Test SqlServer test on Ubuntu in helix
Resolves #19974 Resolves #20128
1 parent 935b8de commit 77a6fbd

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

azure-pipelines.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ stages:
191191
value: $(_BuildConfig)
192192
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
193193
- name: HelixTargetQueues
194-
value: Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open
194+
value: Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open;[email protected]/dotnet-buildtools/prereqs:ubuntu-18.04-helix-sqlserver-amd64-20201109180804-3069967
195195
- name: _HelixAccessToken
196196
value: '' # Needed for public queues
197197
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
198198
- name: HelixTargetQueues
199-
value: Windows.10.Amd64;Ubuntu.1804.Amd64;OSX.1014.Amd64
199+
value: Windows.10.Amd64;Ubuntu.1804.Amd64;OSX.1014.Amd64;[email protected]/dotnet-buildtools/prereqs:ubuntu-18.04-helix-sqlserver-amd64-20201109180804-3069967
200200
- name: _HelixAccessToken
201201
value: $(HelixApiAccessToken) # Needed for internal queues
202202
steps:
@@ -221,6 +221,7 @@ stages:
221221
env:
222222
HelixAccessToken: $(_HelixAccessToken)
223223
SYSTEM_ACCESSTOKEN: $(System.AccessToken) # We need to set this env var to publish helix results to Azure Dev Ops
224+
MSSQL_SA_PASSWORD: "Password12!"
224225

225226
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
226227
- template: eng\common\templates\post-build\post-build.yml

eng/helix.proj

+15-7
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
<FailOnTestFailure>true</FailOnTestFailure>
1515
<EnableXUnitReporter>true</EnableXUnitReporter>
1616
<FailOnMissionControlTestFailure>true</FailOnMissionControlTestFailure>
17+
<SqlServerTests>$(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj;$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj</SqlServerTests>
1718
</PropertyGroup>
1819

1920
<PropertyGroup Condition = "'$(SYSTEM_ACCESSTOKEN)' == ''">
2021
<!-- Local build outside of Azure Pipeline -->
21-
<HelixTargetQueues Condition = "'$(HelixTargetQueues)' == ''">Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open</HelixTargetQueues>
22+
<HelixTargetQueues Condition = "'$(HelixTargetQueues)' == ''">Windows.10.Amd64.Open;Ubuntu.1804.Amd64.Open;OSX.1014.Amd64.Open;[email protected]/dotnet-buildtools/prereqs:ubuntu-18.04-helix-sqlserver-amd64-20201109180804-3069967</HelixTargetQueues>
2223
<EnableAzurePipelinesReporter>false</EnableAzurePipelinesReporter>
2324
<FailOnMissionControlTestFailure>false</FailOnMissionControlTestFailure>
2425
<HelixSource>efcore/localbuild/</HelixSource>
@@ -33,17 +34,24 @@
3334

3435
<!-- Start LocalDb instance for test projects which uses SqlServer on windows -->
3536
<ItemGroup Condition = "'$(HelixTargetQueue.StartsWith(`Windows`))'">
36-
<XUnitProject Update="$(RepoRoot)/test/EFCore.SqlServer.FunctionalTests/*.csproj">
37+
<XUnitProject Update="$(SqlServerTests);$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj">
3738
<PreCommands>$(PreCommands); SqlLocalDB start</PreCommands>
3839
</XUnitProject>
39-
<XUnitProject Update="$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj">
40-
<PreCommands>$(PreCommands); SqlLocalDB start</PreCommands>
41-
</XUnitProject>
42-
<XUnitProject Update="$(RepoRoot)/test/EFCore.OData.FunctionalTests/*.csproj">
43-
<PreCommands>$(PreCommands); SqlLocalDB start</PreCommands>
40+
</ItemGroup>
41+
42+
<!-- Start SqlServer instance for test projects which uses SqlServer on docker. Also remove other projects as they will be run outside of docker. -->
43+
<ItemGroup Condition = "'$(HelixTargetQueue.Contains(`ubuntu-18.04-helix-sqlserver-amd64`))'">
44+
<XUnitProject Remove="$(RepoRoot)/test/**/*.csproj"/>
45+
<XUnitProject Include="$(SqlServerTests);$(RepoRoot)/test/EFCore.CrossStore.FunctionalTests/*.csproj">
46+
<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>
4447
</XUnitProject>
4548
</ItemGroup>
4649

50+
<!-- Remove test projects which requires SqlServer from Ubuntu/OSX. -->
51+
<ItemGroup Condition = "'$(HelixTargetQueue.StartsWith(`OSX`))' OR '$(HelixTargetQueue)' == 'Ubuntu.1804.Amd64.Open' OR '$(HelixTargetQueue)' == 'Ubuntu.1804.Amd64'">
52+
<XUnitProject Remove="$(SqlServerTests)"/>
53+
</ItemGroup>
54+
4755
<PropertyGroup>
4856
<XUnitPublishTargetFramework>net5.0</XUnitPublishTargetFramework>
4957
<XUnitRuntimeTargetFramework>netcoreapp2.0</XUnitRuntimeTargetFramework>

test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public override async Task<string> FromSqlRaw_queryable_composed(bool async)
5555
WHERE [c].[ContactName] LIKE N'%z%'";
5656

5757
AssertSql(expected);
58-
Assert.Equal(expected, queryString);
58+
Assert.Equal(expected, queryString, ignoreLineEndingDifferences: true);
5959

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

360360
return null;
361361
}

0 commit comments

Comments
 (0)