Skip to content

Commit 6912dda

Browse files
author
John Luo
authored
Add gRPC interop tests (again) (#20069)
* Revert "Revert "Add gRPC interop tests (#17040)" (#20047)" This reverts commit 236dcd9. * Fix daily and quarantine Helix runs * Cleanup
1 parent 0d80ffa commit 6912dda

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2348
-12
lines changed

.azure/pipelines/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,9 @@ stages:
674674
# Build the shared framework
675675
- script: ./build.cmd -ci -all -pack -arch x64 -buildNative /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.build.x64.binlog
676676
displayName: Build shared fx
677-
- script: .\restore.cmd -ci
677+
- script: .\restore.cmd -ci /p:BuildInteropProjects=true
678678
displayName: Restore
679-
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
679+
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildInteropProjects=true /p:BuildNative=true /p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
680680
displayName: Run build.cmd helix target
681681
env:
682682
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues
@@ -699,9 +699,9 @@ stages:
699699
- script: ./build.cmd -ci -all -pack -arch x64 -buildNative /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.daily.build.x64.binlog
700700
displayName: Build shared fx
701701
# Build the x86 shared framework
702-
- script: .\restore.cmd -ci
702+
- script: .\restore.cmd -ci /p:BuildInteropProjects=true
703703
displayName: Restore
704-
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildNative=true /p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
704+
- script: .\build.cmd -ci -NoRestore -test -projects eng\helix\helix.proj /p:IsHelixJob=true /p:IsHelixDaily=true /p:BuildAllProjects=true /p:BuildInteropProjects=true /p:BuildNative=true /p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
705705
displayName: Run build.cmd helix target
706706
env:
707707
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues

.azure/pipelines/quarantined-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ jobs:
3333
# Build the shared framework
3434
- script: ./build.cmd -ci -all -pack -arch x64 -buildNative /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log /bl:artifacts/log/helix.build.x64.binlog
3535
displayName: Build shared fx
36-
- script: .\restore.cmd -ci
36+
- script: .\restore.cmd -ci /p:BuildInteropProjects=true
3737
displayName: Restore
38-
- script: .\build.cmd -ci -NoRestore -test -noBuildJava -projects eng\helix\helix.proj /p:RunQuarantinedTests=true /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildNative=true /p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
38+
- script: .\build.cmd -ci -NoRestore -test -noBuildJava -projects eng\helix\helix.proj /p:RunQuarantinedTests=true /p:IsRequiredCheck=true /p:IsHelixJob=true /p:BuildAllProjects=true /p:BuildInteropProjects=true /p:BuildNative=true /p:RunTemplateTests=true /p:ASPNETCORE_TEST_LOG_DIR=artifacts/log -bl
3939
displayName: Run build.cmd helix target
4040
env:
4141
HelixApiAccessToken: $(HelixApiAccessToken) # Needed for internal queues

Directory.Build.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,5 +167,7 @@
167167
<Import Project="eng\targets\Npm.Common.targets" Condition="'$(MSBuildProjectExtension)' == '.npmproj'" />
168168
<Import Project="eng\targets\ReferenceAssembly.targets" Condition=" $(HasReferenceAssembly) " />
169169
<Import Project="eng\targets\Helix.targets" Condition="'$(IsTestProject)' == 'true'" />
170+
<Import Project="eng\targets\FunctionalTestAsset.targets" Condition="'$(IsTestAssetProject)' == 'true'" />
171+
<Import Project="eng\targets\FunctionalTestWithAssets.targets" Condition="'$(ContainsFunctionalTestAssets)' == 'true'" />
170172

171173
</Project>

eng/Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@
123123
<ProjectToBuild Condition=" '$(BuildJava)' == 'true'" Include="@(JavaProjects)" Exclude="@(ProjectToExclude)" />
124124
<ProjectToExclude Condition=" '$(BuildJava)' != 'true'" Include="@(JavaProjects)" />
125125

126+
<!-- These interop test projects can only be restored and built after the shared framework is built -->
127+
<InteropProjects Include="$(RepoRoot)src\Grpc\**\*.csproj"
128+
Exclude="@(ProjectToExclude)" />
129+
130+
<ProjectToBuild Condition=" '$(BuildInteropProjects)' == 'true'" Include="@(InteropProjects)" Exclude="@(ProjectToExclude)" />
131+
<ProjectToExclude Condition=" '$(BuildInteropProjects)' != 'true'" Include="@(InteropProjects)" />
132+
126133
<!--
127134
Use caution to avoid deep recursion. If the globbing pattern picks up something which exceeds MAX_PATH,
128135
the entire pattern will silently fail to evaluate correctly.

eng/Dependencies.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,13 @@ and are generated based on the last package release.
154154
<ItemGroup Label="External dependencies" Condition="'$(DotNetBuildFromSource)' != 'true'">
155155
<LatestPackageReference Include="AngleSharp" Version="$(AngleSharpPackageVersion)" />
156156
<LatestPackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
157+
<LatestPackageReference Include="CommandLineParser" Version="$(CommandLineParserPackageVersion)" />
157158
<LatestPackageReference Include="FSharp.Core" Version="$(FSharpCorePackageVersion)" />
158-
<LatestPackageReference Include="Google.ProtoBuf" Version="$(GoogleProtoBufPackageVersion)" />
159+
<LatestPackageReference Include="Google.Protobuf" Version="$(GoogleProtobufPackageVersion)" />
160+
<LatestPackageReference Include="Grpc.AspNetCore" Version="$(GrpcAspNetCorePackageVersion)" />
161+
<LatestPackageReference Include="Grpc.Auth" Version="$(GrpcAuthPackageVersion)" />
162+
<LatestPackageReference Include="Grpc.Net.Client" Version="$(GrpcNetClientPackageVersion)" />
163+
<LatestPackageReference Include="Grpc.Tools" Version="$(GrpcToolsPackageVersion)" />
159164
<LatestPackageReference Include="IdentityServer4" Version="$(IdentityServer4PackageVersion)" />
160165
<LatestPackageReference Include="IdentityServer4.AspNetIdentity" Version="$(IdentityServer4AspNetIdentityPackageVersion)" />
161166
<LatestPackageReference Include="IdentityServer4.EntityFramework" Version="$(IdentityServer4EntityFrameworkPackageVersion)" />

eng/Versions.props

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,13 @@
217217
<AngleSharpPackageVersion>0.9.9</AngleSharpPackageVersion>
218218
<BenchmarkDotNetPackageVersion>0.12.0</BenchmarkDotNetPackageVersion>
219219
<CastleCorePackageVersion>4.2.1</CastleCorePackageVersion>
220+
<CommandLineParserPackageVersion>2.3.0</CommandLineParserPackageVersion>
220221
<FSharpCorePackageVersion>4.2.1</FSharpCorePackageVersion>
221-
<GoogleProtobufPackageVersion>3.8.0</GoogleProtobufPackageVersion>
222+
<GoogleProtobufPackageVersion>3.10.0</GoogleProtobufPackageVersion>
222223
<GrpcAspNetCorePackageVersion>2.27.0</GrpcAspNetCorePackageVersion>
224+
<GrpcAuthPackageVersion>2.27.0</GrpcAuthPackageVersion>
225+
<GrpcNetClientPackageVersion>2.27.0</GrpcNetClientPackageVersion>
226+
<GrpcToolsPackageVersion>2.27.0</GrpcToolsPackageVersion>
223227
<IdentityServer4AspNetIdentityPackageVersion>3.0.0</IdentityServer4AspNetIdentityPackageVersion>
224228
<IdentityServer4EntityFrameworkPackageVersion>3.0.0</IdentityServer4EntityFrameworkPackageVersion>
225229
<IdentityServer4PackageVersion>3.0.0</IdentityServer4PackageVersion>

eng/helix/content/runtests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ echo "Creating nugetRestore directory: $NUGET_RESTORE"
4141
mkdir $NUGET_RESTORE
4242
mkdir logs
4343

44-
ls -la
44+
ls -laR
4545

4646
RESET="\033[0m"
4747
RED="\033[0;31m"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project>
2+
<Target Name="CollectFunctionalTestPayload" DependsOnTargets="Publish" Returns="@(DependencyPayload)" >
3+
<ItemGroup>
4+
<DependencyPayload Include="@(ResolvedFileToPublish)">
5+
<RelativePath>$(MSBuildProjectName)\%(ResolvedFileToPublish.RelativePath)</RelativePath>
6+
</DependencyPayload>
7+
</ItemGroup>
8+
</Target>
9+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project>
2+
3+
<ItemGroup>
4+
<ProjectReference Include="@(FunctionalTestAssetProjectReference)" ReferenceOutputAssembly="false" />
5+
</ItemGroup>
6+
7+
<Target Name="CollectTestAssetPayload" BeforeTargets="GetCopyToOutputDirectoryItems" >
8+
<MSBuild Targets="CollectFunctionalTestPayload"
9+
BuildInParallel="true"
10+
SkipNonexistentTargets="true"
11+
Projects="%(FunctionalTestAssetProjectReference.Identity)"
12+
RebaseOutputs="True">
13+
<Output TaskParameter="TargetOutputs" ItemName="DependencyPayload" />
14+
</MSBuild>
15+
16+
<ItemGroup>
17+
<ContentWithTargetPath
18+
Include="@(DependencyPayload)"
19+
Condition="'@(DependencyPayload->Count())' != '0'">
20+
<TargetPath>%(DependencyPayload.RelativePath)</TargetPath>
21+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
22+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
23+
</ContentWithTargetPath>
24+
</ItemGroup>
25+
</Target>
26+
27+
</Project>

src/Grpc/Grpc.sln

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29505.145
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0FFB3605-0203-450F-80C8-F82CA2E8269F}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testassets", "testassets", "{F5841B0A-901A-448F-9CC5-4CB393CE86AF}"
9+
EndProject
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteropTests", "test\InteropTests\InteropTests.csproj", "{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}"
11+
EndProject
12+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteropWebsite", "test\testassets\InteropWebsite\InteropWebsite.csproj", "{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}"
13+
EndProject
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteropClient", "test\testassets\InteropClient\InteropClient.csproj", "{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}"
15+
EndProject
16+
Global
17+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
18+
Debug|Any CPU = Debug|Any CPU
19+
Release|Any CPU = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Release|Any CPU.Build.0 = Release|Any CPU
30+
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
33+
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Release|Any CPU.Build.0 = Release|Any CPU
34+
EndGlobalSection
35+
GlobalSection(SolutionProperties) = preSolution
36+
HideSolutionNode = FALSE
37+
EndGlobalSection
38+
GlobalSection(NestedProjects) = preSolution
39+
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2} = {0FFB3605-0203-450F-80C8-F82CA2E8269F}
40+
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45} = {F5841B0A-901A-448F-9CC5-4CB393CE86AF}
41+
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F} = {F5841B0A-901A-448F-9CC5-4CB393CE86AF}
42+
EndGlobalSection
43+
GlobalSection(ExtensibilityGlobals) = postSolution
44+
SolutionGuid = {3CAE66FD-9A59-49C2-B133-1D599225259A}
45+
EndGlobalSection
46+
EndGlobal

src/Grpc/THIRD-PARTY-NOTICES

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.NET Core uses third-party libraries or other resources that may be
2+
distributed under licenses different than the .NET Core software.
3+
4+
In the event that we accidentally failed to list a required notice, please
5+
bring it to our attention. Post an issue or email us:
6+
7+
8+
9+
The attached notices are provided for information only.
10+
11+
License notice for gRPC interop tests
12+
-------------------------------------
13+
14+
Copyright 2019 The gRPC Authors
15+
16+
Licensed under the Apache License, Version 2.0 (the "License");
17+
you may not use this file except in compliance with the License.
18+
You may obtain a copy of the License at
19+
20+
http://www.apache.org/licenses/LICENSE-2.0
21+
22+
Unless required by applicable law or agreed to in writing, software
23+
distributed under the License is distributed on an "AS IS" BASIS,
24+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25+
See the License for the specific language governing permissions and
26+
limitations under the License.

src/Grpc/build.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
SET RepoRoot=%~dp0..\..
3+
%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %*

src/Grpc/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
repo_root="$DIR/../.."
7+
"$repo_root/build.sh" --projects "$DIR/**/*.*proj" "$@"

src/Grpc/startvs.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@ECHO OFF
2+
3+
%~dp0..\..\startvs.cmd %~dp0Grpc.sln
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Diagnostics;
6+
using System.Threading.Tasks;
7+
using Microsoft.AspNetCore.Internal;
8+
using Xunit.Abstractions;
9+
10+
namespace InteropTests.Helpers
11+
{
12+
public class ClientProcess : IDisposable
13+
{
14+
private readonly Process _process;
15+
private readonly ProcessEx _processEx;
16+
private readonly TaskCompletionSource<object> _startTcs;
17+
18+
public ClientProcess(ITestOutputHelper output, string path, string serverPort, string testCase)
19+
{
20+
_process = new Process();
21+
_process.StartInfo = new ProcessStartInfo
22+
{
23+
RedirectStandardOutput = true,
24+
RedirectStandardError = true,
25+
FileName = "dotnet",
26+
Arguments = @$"{path} --use_tls false --server_port {serverPort} --client_type httpclient --test_case {testCase}"
27+
};
28+
_process.EnableRaisingEvents = true;
29+
_process.OutputDataReceived += Process_OutputDataReceived;
30+
_process.Start();
31+
32+
_processEx = new ProcessEx(output, _process);
33+
34+
_startTcs = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
35+
}
36+
37+
public Task WaitForReady()
38+
{
39+
return _startTcs.Task;
40+
}
41+
42+
public int ExitCode => _process.ExitCode;
43+
public Task Exited => _processEx.Exited;
44+
45+
private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)
46+
{
47+
var data = e.Data;
48+
if (data != null)
49+
{
50+
if (data.Contains("Application started."))
51+
{
52+
_startTcs.TrySetResult(null);
53+
}
54+
}
55+
}
56+
57+
public void Dispose()
58+
{
59+
_processEx.Dispose();
60+
}
61+
}
62+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) .NET Foundation. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.Threading.Tasks;
6+
using Xunit.Abstractions;
7+
8+
namespace InteropTests.Helpers
9+
{
10+
public class InteropTestsFixture : IDisposable
11+
{
12+
private WebsiteProcess _process;
13+
14+
public string Path { get; set; }
15+
16+
17+
public string ServerPort { get; private set; }
18+
19+
20+
public async Task EnsureStarted(ITestOutputHelper output)
21+
{
22+
if (_process != null)
23+
{
24+
return;
25+
}
26+
27+
if (string.IsNullOrEmpty(Path))
28+
{
29+
throw new InvalidOperationException("Path has not been set.");
30+
}
31+
32+
_process = new WebsiteProcess(Path, output);
33+
34+
await _process.WaitForReady();
35+
36+
ServerPort = _process.ServerPort;
37+
}
38+
39+
public void Dispose()
40+
{
41+
_process.Dispose();
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)