Skip to content
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

[Android] gRPC client tests #73060

Merged
merged 36 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
d2dbd2b
WIP: add gRPC tests
simonrozsival Jun 8, 2022
ea8b368
Merge branch 'main' of https://github.com/dotnet/runtime into android…
simonrozsival Jun 9, 2022
1dcf0e8
Fix AOT and trimming
simonrozsival Jun 9, 2022
2941f15
WIP
simonrozsival Jun 23, 2022
66b2939
Implement IncludeNetworkSecurityConfig
simonrozsival Jun 27, 2022
6ef8d85
Use IncludeNetworkSecurityConfig
simonrozsival Jun 27, 2022
5740a9b
Fix gRPC test
simonrozsival Jun 27, 2022
b99fc44
Avoid git checkout
simonrozsival Jun 27, 2022
be51a78
Remove unnecessary code
simonrozsival Jun 27, 2022
0d4837c
Merge branch 'main' of https://github.com/dotnet/runtime into android…
simonrozsival Jul 20, 2022
28629ae
WIP: start working on CI configuration
simonrozsival Jul 20, 2022
85eb854
Remove WinHttpHandler
simonrozsival Jul 29, 2022
b4b2d09
Fix problem with SSL
simonrozsival Jul 29, 2022
9dac1c4
Change server host
simonrozsival Jul 29, 2022
3a8908f
Setup CI (#1)
directhex Jul 29, 2022
3276d50
Use tls
simonrozsival Jul 29, 2022
b7b40e7
Update yml
simonrozsival Jul 29, 2022
44bd21c
Revert changes to the mono Android sample app
simonrozsival Jul 29, 2022
805790e
Merge branch 'main' of github.com:dotnet/runtime into simonrozsival/a…
simonrozsival Aug 9, 2022
6e7f96e
Bump android image version
simonrozsival Aug 9, 2022
41d80a2
Bump image version
simonrozsival Aug 10, 2022
124ed66
Enable TLS
simonrozsival Aug 10, 2022
39f4009
Remove hardcoded package versions
simonrozsival Aug 12, 2022
a11e4a8
Update package versions
simonrozsival Aug 12, 2022
764f745
Update package versions
simonrozsival Aug 12, 2022
e996d02
Rename pipeline
simonrozsival Aug 24, 2022
09c67c3
Move interop tests website dependencies versions to Versions.props
simonrozsival Aug 24, 2022
c1bb0dd
Add cred scan supression for the interop test server private key
simonrozsival Aug 24, 2022
b9a02d8
Fix licenses
simonrozsival Aug 24, 2022
6691bc0
Remove dependencies
simonrozsival Aug 24, 2022
0722991
Merge branch 'main' into simonrozsival/android-grpc-client-tests
simonrozsival Aug 24, 2022
32034ad
Fix path to Versions.props
simonrozsival Aug 24, 2022
785ba5e
Merge branch 'simonrozsival/android-grpc-client-tests' of github.com:…
simonrozsival Aug 24, 2022
d2ac3d8
Remove unnecessary dependency version
simonrozsival Aug 24, 2022
3bb36bf
Fix building docker image
simonrozsival Aug 24, 2022
2cf9df9
Change pfx password
simonrozsival Aug 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .config/CredScanSuppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAKeyPemTests.cs",
"src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/ECKeyPemTests.cs",
"src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAKeyPemTests.cs",
"src/libraries/System.Security.Cryptography/tests/X509Certificates/TestData.cs"
"src/libraries/System.Security.Cryptography/tests/X509Certificates/TestData.cs",
"src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet/testassets/Certs/InteropTests/server1.key"
],
"placeholder": [
"-----BEGIN PRIVATE KEY-----",
Expand Down
8 changes: 8 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,14 @@
<SQLitePCLRawbundle_greenVersion>2.0.4</SQLitePCLRawbundle_greenVersion>
<MoqVersion>4.12.0</MoqVersion>
<FsCheckVersion>2.14.3</FsCheckVersion>
<!-- Android gRPC client tests -->
<GoogleProtobufVersion>3.19.4</GoogleProtobufVersion>
<GrpcAspNetCoreVersion>2.46.0</GrpcAspNetCoreVersion>
<GrpcAspNetCoreWebVersion>2.46.0</GrpcAspNetCoreWebVersion>
<GrpcAuthVersion>2.46.3</GrpcAuthVersion>
<GrpcCoreVersion>2.46.3</GrpcCoreVersion>
<GrpcDotnetClientVersion>2.45.0</GrpcDotnetClientVersion>
<GrpcToolsVersion>2.45.0</GrpcToolsVersion>
<!-- Uncomment to set a fixed version, else the latest is used -->
<!--<SdkVersionForWorkloadTesting>7.0.100-rc.1.22402.35</SdkVersionForWorkloadTesting>-->
<CompilerPlatformTestingVersion>1.1.2-beta1.22403.2</CompilerPlatformTestingVersion>
Expand Down
1 change: 1 addition & 0 deletions eng/liveBuilds.targets
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<CoreCLRBuildIntegrationDir>$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))</CoreCLRBuildIntegrationDir>

<MonoAotCrossDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'cross', $(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())))</MonoAotCrossDir>
<GrpcServerDockerImageDir>$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'obj', 'grpcserver', 'docker'))</GrpcServerDockerImageDir>

<LibrariesPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesArtifactsPath)', 'packages', '$(LibrariesConfiguration)'))</LibrariesPackagesDir>
<LibrariesShippingPackagesDir>$([MSBuild]::NormalizeDirectory('$(LibrariesPackagesDir)', 'Shipping'))</LibrariesShippingPackagesDir>
Expand Down
12 changes: 6 additions & 6 deletions eng/pipelines/common/platform-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ jobs:
platform: Linux_bionic_arm64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container:
image: ubuntu-18.04-android-20220628174908-5789942
image: ubuntu-18.04-android-20220808192756-8fcaabc
registry: mcr
jobParameters:
runtimeFlavor: mono
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
platform: Linux_bionic_x64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container:
image: ubuntu-18.04-android-20220628174908-5789942
image: ubuntu-18.04-android-20220808192756-8fcaabc
registry: mcr
jobParameters:
runtimeFlavor: mono
Expand Down Expand Up @@ -494,7 +494,7 @@ jobs:
platform: Android_x64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container:
image: ubuntu-18.04-android-20220628174908-5789942
image: ubuntu-18.04-android-20220808192756-8fcaabc
registry: mcr
jobParameters:
runtimeFlavor: mono
Expand All @@ -519,7 +519,7 @@ jobs:
platform: Android_x86
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container:
image: ubuntu-18.04-android-20220628174908-5789942
image: ubuntu-18.04-android-20220808192756-8fcaabc
registry: mcr
jobParameters:
runtimeFlavor: mono
Expand All @@ -544,7 +544,7 @@ jobs:
platform: Android_arm
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container:
image: ubuntu-18.04-android-20220628174908-5789942
image: ubuntu-18.04-android-20220808192756-8fcaabc
registry: mcr
jobParameters:
runtimeFlavor: mono
Expand All @@ -569,7 +569,7 @@ jobs:
platform: Android_arm64
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
container:
image: ubuntu-18.04-android-20220628174908-5789942
image: ubuntu-18.04-android-20220808192756-8fcaabc
registry: mcr
jobParameters:
runtimeFlavor: mono
Expand Down
45 changes: 45 additions & 0 deletions eng/pipelines/runtime-android-grpc-client-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# We run this pipeline on a schedule and also developers can run it
# via /azp run command on PRs.
#
# Setting batch to true, triggers one build at a time.
# if there is a push while a build in progress, it will wait,
# until the running build finishes, and produce a build with all the changes
# that happened during the last build.
trigger: none

schedules:
- cron: "0 9,21 * * *" # run at 9:00 and 21:00 (UTC) which is 1:00 and 13:00 (PST).
displayName: grpc-dotnet Android client test schedule
branches:
include:
- main
always: true

variables:
- template: /eng/pipelines/common/variables.yml

jobs:

#
# Android emulators
# Build the whole product using Mono and run libraries tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
- Android_x64
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono_gRPC
buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunGrpcTestsOnly=true /p:BuildGrpcServerDockerImage=true
timeoutInMinutes: 180
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
extraHelixArguments: /p:RunGrpcTestsOnly=true /p:BuildGrpcServerDockerImage=true
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
9 changes: 9 additions & 0 deletions src/libraries/sendtohelixhelp.proj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@
<HelixProperties Condition="'$(Scenario)' != ''" Include="scenario" Value="$(Scenario)" />
</ItemGroup>

<ItemGroup Condition="'$(RunGrpcTestsOnly)' == 'true' and '$(BuildGrpcServerDockerImage)' == 'true'">
<HelixCorrelationPayload Include="$(GrpcServerDockerImageDir)" Destination="grpcserver" />
<HelixPreCommand Include="docker load -i $HELIX_CORRELATION_PAYLOAD/grpcserver/grpcserver.tar" />
<HelixPreCommand Include="docker run --name grpc-server -d -p 50052:50052 -p 80:80 grpc-server:latest" />
<HelixPostCommand Include="docker stop grpc-server" />
<HelixPostCommand Include="docker rmi -f grpc-server:latest" />
</ItemGroup>

<!-- Ensure that all HelixPreCommand items are ready before this -->
<Target Name="BuildHelixCommand">
<!-- setting DotNetCliVersion here to ensure that it is set to the intended value -->
Expand All @@ -165,6 +173,7 @@

<PropertyGroup>
<HelixPreCommands>@(HelixPreCommand)</HelixPreCommands>
<HelixPostCommands>@(HelixPostCommand)</HelixPostCommands>
<HelixCommandPrefix Condition="'$(WindowsShell)' == 'true' and @(HelixCommandPrefixItem->Count()) > 0" >$(HelixCommandPrefix) @(HelixCommandPrefixItem -> 'set &quot;%(Identity)&quot;', ' &amp; ')</HelixCommandPrefix>
<HelixCommandPrefix Condition="'$(WindowsShell)' != 'true' and @(HelixCommandPrefixItem->Count()) > 0 ">$(HelixCommandPrefix) @(HelixCommandPrefixItem, ' ')</HelixCommandPrefix>
<IncludeHelixCorrelationPayload Condition="'$(IncludeHelixCorrelationPayload)' == '' and '$(HelixCorrelationPayload)' != ''">true</IncludeHelixCorrelationPayload>
Expand Down
20 changes: 13 additions & 7 deletions src/libraries/tests.proj
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@
<!-- Crashes on CI (possibly flakey) -->
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Private.Xml/tests/Misc/System.Xml.Misc.Tests.csproj" />
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Dynamic.Runtime/tests/System.Dynamic.Runtime.Tests.csproj"/>

<!-- gRPC tests should be run only manually -->
<ProjectExclusions Include="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\gRPC\Android.Device_Emulator.gRPC.Test.csproj" />
</ItemGroup>

<ItemGroup Condition="('$(TargetOS)' == 'Android' or '$(TargetsLinuxBionic)' == 'true') and '$(TargetArchitecture)' == 'arm64' and '$(RunDisabledAndroidTests)' != 'true'">
Expand Down Expand Up @@ -540,7 +543,8 @@
</ItemGroup>

<ItemGroup>
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Runtime.Tests.csproj" />
<SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Runtime.Tests.csproj" />
<GrpcTestProject Include="$(RepoRoot)\src\tests\FunctionalTests\Android\Device_Emulator\gRPC\Android.Device_Emulator.gRPC.Test.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TestNativeAot)' == 'true'">
Expand All @@ -560,9 +564,11 @@
<ProjectReference Condition="'$(RunHighAOTResourceRequiringTestsOnly)' == 'true'"
Include="@(HighAOTResourceRequiringProject)"
BuildInParallel="false" />
<ProjectReference Condition="'$(RunGrpcTestsOnly)' == 'true'"
Include="@(GrpcTestProject)" />
</ItemGroup>

<ItemGroup Condition="'$(RunSmokeTestsOnly)' != 'true' and '$(RunHighAOTResourceRequiringTestsOnly)' != 'true'">
<ItemGroup Condition="'$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(RunHighAOTResourceRequiringTestsOnly)' != 'true'">
<ProjectReference Include="$(MSBuildThisFileDirectory)*\tests\**\*.Tests.csproj"
Exclude="@(ProjectExclusions)"
Condition="'$(TestAssemblies)' == 'true'" />
Expand Down Expand Up @@ -606,7 +612,7 @@
<ProjectReference Include="$(MSBuildThisFileDirectory)System.Formats.Cbor\tests\System.Formats.Cbor.Tests.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(TargetOS)' == 'iOSSimulator'">
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'iOSSimulator'">
<!-- https://github.com/dotnet/runtime/issues/57666 -->
<!-- <ProjectReference Include="$(MonoProjectRoot)sample\iOS\Program.csproj"
BuildInParallel="false" /> -->
Expand All @@ -615,13 +621,13 @@
BuildInParallel="false" />
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(TargetOS)' == 'tvOS'">
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'tvOS'">
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\tvOS\Device\**\*.Test.csproj"
Exclude="@(ProjectExclusions)"
BuildInParallel="false" />
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(TargetOS)' == 'MacCatalyst'">
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'MacCatalyst'">
<!-- https://github.com/dotnet/runtime/issues/57666 -->
<!-- <ProjectReference Include="$(MonoProjectRoot)sample\iOS\Program.csproj"
BuildInParallel="false" /> -->
Expand All @@ -630,13 +636,13 @@
BuildInParallel="false" />
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(TargetOS)' == 'tvOSSimulator'">
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'tvOSSimulator'">
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\tvOS\Simulator\**\*.Test.csproj"
Exclude="@(ProjectExclusions)"
BuildInParallel="false" />
</ItemGroup>

<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(TargetOS)' == 'Android'">
<ItemGroup Condition="'$(ArchiveTests)' == 'true' and '$(RunSmokeTestsOnly)' != 'true' and '$(RunGrpcTestsOnly)' != 'true' and '$(TargetOS)' == 'Android'">
<ProjectReference Include="$(MonoProjectRoot)sample\Android\AndroidSampleApp.csproj"
BuildInParallel="false" />
<ProjectReference Include="$(RepoRoot)\src\tests\FunctionalTests\Android\**\*.Test.csproj"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TestRuntime>true</TestRuntime>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<MainLibraryFileName>Android.Device_Emulator.gRPC.Test.dll</MainLibraryFileName>
<ExpectedExitCode>42</ExpectedExitCode>

<MonoForceInterpreter>false</MonoForceInterpreter>
<RunAOTCompilation>true</RunAOTCompilation>
<ForceAOT>true</ForceAOT>
<AOTWithLibraryFiles>true</AOTWithLibraryFiles>

<PublishTrimmed>true</PublishTrimmed>
<EnableAggressiveTrimming>true</EnableAggressiveTrimming>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Disable CS8981 because the generated code from the protobuf files contains classes with lowercase names -->
<!-- Disable SYSLIB0039 because the tests intentionally use TLS 1.0 and 1.1 -->
<NoWarn>CS8981;SYSLIB0039</NoWarn>
</PropertyGroup>

<PropertyGroup>
<IncludeNetworkSecurityConfig>true</IncludeNetworkSecurityConfig>
</PropertyGroup>

<ItemGroup>
<Compile Include="Program.cs" />

<None Include="$(MSBuildProjectDirectory)\res\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<!-- Based on grpc-dotnet's testassets/InteropTestsClient/InteropTestsClient.csproj -->
<ItemGroup>
<!-- Required for QUIC & HTTP/3 in .NET 6 - https://github.com/dotnet/runtime/pull/55332 -->
<RuntimeHostConfigurationOption Include="System.Net.SocketsHttpHandler.Http3Support" Value="true" />

<Compile Include="$(MSBuildProjectDirectory)\grpc-dotnet\testassets\Shared\*.cs" />
<Compile Include="$(MSBuildProjectDirectory)\grpc-dotnet\test\Shared\HttpEventSourceListener.cs" />

<Protobuf
Include="$(MSBuildProjectDirectory)\grpc-dotnet\testassets\Proto\grpc\testing\*.proto"
ProtoRoot="$(MSBuildProjectDirectory)\grpc-dotnet\testassets\Proto\grpc\testing\"
GrpcServices="Client" />

<PackageReference Include="Google.Protobuf" Version="$(GoogleProtobufVersion)" />
<PackageReference Include="Grpc.Auth" Version="$(GrpcAuthVersion)" />
<PackageReference Include="Grpc.Core" Version="$(GrpcCoreVersion)" PrivateAssets="All" />
<PackageReference Include="Grpc.Net.Client" Version="$(GrpcDotnetClientVersion)" />
<PackageReference Include="Grpc.Tools" Version="$(GrpcToolsVersion)" PrivateAssets="All" />
</ItemGroup>

<Target Name="BuildServerDockerImage" AfterTargets="Build" Condition="'$(BuildGrpcServerDockerImage)' == 'true'">
<Exec Command="cp $(RepoRoot)eng/Versions.props grpc-dotnet/testassets/InteropTestsWebsite/" />
<Exec Command="docker build -t grpc-server:latest grpc-dotnet/testassets/" />
<Exec Command="mkdir -p $(ArtifactsObjDir)/grpcserver/docker/" />
<Exec Command="docker save -o $(ArtifactsObjDir)/grpcserver/docker/grpcserver.tar grpc-server:latest" />
</Target>
</Project>
91 changes: 91 additions & 0 deletions src/tests/FunctionalTests/Android/Device_Emulator/gRPC/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
simonrozsival marked this conversation as resolved.
Show resolved Hide resolved
using System.Diagnostics.CodeAnalysis;

// The code of the tests is cloned from https://github.com/grpc/grpc-dotnet
using Grpc.Shared.TestAssets;

var skippedTests = new[]
{
"compute_engine_creds",
"jwt_token_creds",
"oauth2_auth_token",
"per_rpc_creds",
"client_compressed_streaming", // flaky test
};

var configurations = new[]
{
new ClientOptions
{
ServerHost = "10.0.2.2",
ServerPort = 50052,
UseTls = true,
},
};

int failedTests = 0;

foreach (var options in configurations)
{
Console.WriteLine($"""
gRPC client options:
--------------------
ClientType: {options.ClientType}
ServerHost: {options.ServerHost}
ServerHostOverride: {options.ServerHostOverride}
ServerPort: {options.ServerPort}
UseTls: {options.UseTls}
UseTestCa: {options.UseTestCa}
DefaultServiceAccount: {options.DefaultServiceAccount}
OAuthScope: {options.OAuthScope}
ServiceAccountKeyFile: {options.ServiceAccountKeyFile}
UseHttp3: {options.UseHttp3}
---
""");

foreach (var testName in InteropClient.TestNames)
{
if (skippedTests.Contains(testName))
{
Log(testName, "SKIPPED");
continue;
}

options.TestCase = testName;
var client = new InteropClientWrapper(options);

try
{
Log(testName, "STARTED");
await client.Run();
Log(testName, "PASSED");
} catch (Exception e) {
Log(testName, "FAILED");
Console.Error.WriteLine(e);
failedTests++;
}
}
}

return 42 + failedTests;

void Log(string testName, string status)
=> Console.WriteLine($"TestCase: {testName} ... {status}");

sealed class InteropClientWrapper
{
private readonly InteropClient _interopClient;

[DynamicDependency(DynamicallyAccessedMemberTypes.All, "Grpc.Testing.TestService.TestServiceClient", "Android.Device_Emulator.gRPC.Test")]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, "Grpc.Testing.UnimplementedService.UnimplementedServiceClient", "Android.Device_Emulator.gRPC.Test")]
public InteropClientWrapper(ClientOptions options)
{
_interopClient = new InteropClient(options);
}

public Task Run()
=> _interopClient.Run();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
res - Android resource folder containing self-signed certificates and Android network configuration
dotnet-grpc - copied from https://github.com/grpc/grpc-dotnet
Loading