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 5 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.X509Certificates/tests/TestData.cs"
"src/libraries/System.Security.Cryptography.X509Certificates/tests/TestData.cs",
"src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet/testassets/Certs/InteropTests/server1.key"
],
"placeholder": [
"-----BEGIN PRIVATE KEY-----",
Expand Down
2 changes: 2 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
<PackageReference Include="Grpc.Core" Version="$(GrpcCoreVersion)" PrivateAssets="All" />
<PackageReference Include="Grpc.Net.Client" Version="$(GrpcDotnetClientVersion)" />
<PackageReference Include="Grpc.Tools" Version="$(GrpcToolsVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingVersion)" />
<PackageReference Include="System.CommandLine" Version="$(SystemCommandLineVersion)" />
</ItemGroup>

<Target Name="BuildServerDockerImage" AfterTargets="Build" Condition="'$(BuildGrpcServerDockerImage)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// 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;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

// The code of the tests is cloned from https://github.com/grpc/grpc-dotnet
using Grpc.Shared.TestAssets;
Expand Down Expand Up @@ -76,18 +77,15 @@ void Log(string testName, string status)

sealed class InteropClientWrapper
{
private readonly InteropClient interopClient;
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,
Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory.Instance
);
_interopClient = new InteropClient(options);
}

public Task Run()
=> interopClient.Run();
=> _interopClient.Run();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.NET Runtime uses third-party libraries or other resources that may be
distributed under licenses different than the .NET Runtime 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.Net.Client
-------------------------------

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
Expand Up @@ -21,9 +21,13 @@
<None Include="..\Certs\InteropTests\*.*" LinkBase="Certs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<Import Project="Versions.props" />
simonrozsival marked this conversation as resolved.
Show resolved Hide resolved

<PackageReference Include="Grpc.AspNetCore" Version="2.46.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.46.0" />
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="$(GrpcAspNetCoreVersion)" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="$(GrpcAspNetCoreWebVersion)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using Grpc.Core;
using Grpc.Net.Client;
using Grpc.Testing;
using Microsoft.Extensions.Logging;
using Empty = Grpc.Testing.Empty;
using System.Security.Authentication;

Expand All @@ -47,32 +46,19 @@ public class InteropClient
internal const string CompressionRequestAlgorithmMetadataKey = "grpc-internal-encoding-request";

private readonly ClientOptions options;
private readonly ILoggerFactory loggerFactory;
private readonly ILogger<InteropClient> logger;

public InteropClient(ClientOptions options, ILoggerFactory loggerFactory)
public InteropClient(ClientOptions options)
{
this.options = options;
this.loggerFactory = loggerFactory;
this.logger = loggerFactory.CreateLogger<InteropClient>();
}

public async Task Run()
{
var channel = HttpClientCreateChannel();

try
{
var message = "Running " + options.TestCase;
logger.LogInformation(message);
await RunTestCaseAsync(channel, options);
logger.LogInformation("Passed!");
}
catch (Exception ex)
{
logger.LogInformation(ex, "Failed!");
throw;
}
var message = "Running " + options.TestCase;
await RunTestCaseAsync(channel, options);

await channel.ShutdownAsync();
}

Expand Down Expand Up @@ -104,7 +90,6 @@ private IChannelWrapper HttpClientCreateChannel()
{
Credentials = credentials,
HttpHandler = httpMessageHandler,
LoggerFactory = loggerFactory
});

return new GrpcChannelWrapper(channel);
Expand Down