-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Add gRPC interop tests (again) #20069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project> | ||
<Target Name="CollectFunctionalTestPayload" DependsOnTargets="Publish" Returns="@(DependencyPayload)" > | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear how this works any better or more extensively than what's already in Helix.targets for all test projects. Shouldn't need to do anything more than remove |
||
<ItemGroup> | ||
<DependencyPayload Include="@(ResolvedFileToPublish)"> | ||
<RelativePath>$(MSBuildProjectName)\%(ResolvedFileToPublish.RelativePath)</RelativePath> | ||
</DependencyPayload> | ||
</ItemGroup> | ||
</Target> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Project> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="@(FunctionalTestAssetProjectReference)" ReferenceOutputAssembly="false" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are the And, why is this infrastructure centralized (it's only used in the gRPC |
||
</ItemGroup> | ||
|
||
<Target Name="CollectTestAssetPayload" BeforeTargets="GetCopyToOutputDirectoryItems" > | ||
<MSBuild Targets="CollectFunctionalTestPayload" | ||
BuildInParallel="true" | ||
SkipNonexistentTargets="true" | ||
Projects="%(FunctionalTestAssetProjectReference.Identity)" | ||
RebaseOutputs="True"> | ||
<Output TaskParameter="TargetOutputs" ItemName="DependencyPayload" /> | ||
</MSBuild> | ||
|
||
<ItemGroup> | ||
<ContentWithTargetPath | ||
Include="@(DependencyPayload)" | ||
Condition="'@(DependencyPayload->Count())' != '0'"> | ||
<TargetPath>%(DependencyPayload.RelativePath)</TargetPath> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory> | ||
</ContentWithTargetPath> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
| ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29505.145 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0FFB3605-0203-450F-80C8-F82CA2E8269F}" | ||
EndProject | ||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testassets", "testassets", "{F5841B0A-901A-448F-9CC5-4CB393CE86AF}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteropTests", "test\InteropTests\InteropTests.csproj", "{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteropWebsite", "test\testassets\InteropWebsite\InteropWebsite.csproj", "{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InteropClient", "test\testassets\InteropClient\InteropClient.csproj", "{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
{90BF37E6-B3F1-4EFC-A233-8288D8B32DD2} = {0FFB3605-0203-450F-80C8-F82CA2E8269F} | ||
{3AB7E8E4-BA36-44CE-844E-39DB66E46D45} = {F5841B0A-901A-448F-9CC5-4CB393CE86AF} | ||
{66E6C55E-E4E3-4F4B-834A-BB34BFE00D2F} = {F5841B0A-901A-448F-9CC5-4CB393CE86AF} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3CAE66FD-9A59-49C2-B133-1D599225259A} | ||
EndGlobalSection | ||
EndGlobal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
.NET Core uses third-party libraries or other resources that may be | ||
distributed under licenses different than the .NET Core software. | ||
|
||
In the event that we accidentally failed to list a required notice, please | ||
bring it to our attention. Post an issue or email us: | ||
|
||
[email protected] | ||
|
||
The attached notices are provided for information only. | ||
|
||
License notice for gRPC interop tests | ||
------------------------------------- | ||
|
||
Copyright 2019 The gRPC Authors | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@ECHO OFF | ||
SET RepoRoot=%~dp0..\.. | ||
%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %* |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
repo_root="$DIR/../.." | ||
"$repo_root/build.sh" --projects "$DIR/**/*.*proj" "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@ECHO OFF | ||
|
||
%~dp0..\..\startvs.cmd %~dp0Grpc.sln |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Internal; | ||
using Xunit.Abstractions; | ||
|
||
namespace InteropTests.Helpers | ||
{ | ||
public class ClientProcess : IDisposable | ||
{ | ||
private readonly Process _process; | ||
private readonly ProcessEx _processEx; | ||
private readonly TaskCompletionSource<object> _startTcs; | ||
|
||
public ClientProcess(ITestOutputHelper output, string path, string serverPort, string testCase) | ||
{ | ||
_process = new Process(); | ||
_process.StartInfo = new ProcessStartInfo | ||
{ | ||
RedirectStandardOutput = true, | ||
RedirectStandardError = true, | ||
FileName = "dotnet", | ||
Arguments = @$"{path} --use_tls false --server_port {serverPort} --client_type httpclient --test_case {testCase}" | ||
}; | ||
_process.EnableRaisingEvents = true; | ||
_process.OutputDataReceived += Process_OutputDataReceived; | ||
_process.Start(); | ||
|
||
_processEx = new ProcessEx(output, _process); | ||
|
||
_startTcs = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously); | ||
} | ||
|
||
public Task WaitForReady() | ||
{ | ||
return _startTcs.Task; | ||
} | ||
|
||
public int ExitCode => _process.ExitCode; | ||
public Task Exited => _processEx.Exited; | ||
|
||
private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e) | ||
{ | ||
var data = e.Data; | ||
if (data != null) | ||
{ | ||
if (data.Contains("Application started.")) | ||
{ | ||
_startTcs.TrySetResult(null); | ||
} | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_processEx.Dispose(); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Threading.Tasks; | ||
using Xunit.Abstractions; | ||
|
||
namespace InteropTests.Helpers | ||
{ | ||
public class InteropTestsFixture : IDisposable | ||
{ | ||
private WebsiteProcess _process; | ||
|
||
public string Path { get; set; } | ||
|
||
|
||
public string ServerPort { get; private set; } | ||
|
||
|
||
public async Task EnsureStarted(ITestOutputHelper output) | ||
{ | ||
if (_process != null) | ||
{ | ||
return; | ||
} | ||
|
||
if (string.IsNullOrEmpty(Path)) | ||
{ | ||
throw new InvalidOperationException("Path has not been set."); | ||
} | ||
|
||
_process = new WebsiteProcess(Path, output); | ||
|
||
await _process.WaitForReady(); | ||
|
||
ServerPort = _process.ServerPort; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_process.Dispose(); | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.