Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
WIP: start working on CI configuration
  • Loading branch information
simonrozsival committed Jul 20, 2022
commit 28629aec216504b7fff5f1861d48c1d62d44dd8a
66 changes: 66 additions & 0 deletions eng/pipelines/android-grpc-client-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# TODO file name == pipeline name (/azp run android-grpc-client-tests ?)
#
# TODO description + instructions
#
# 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 # the test is independent of the changes to the main branch since the client code is in another repo

# TODO do we need those variables?
# variables:
# - template: /eng/pipelines/common/variables.yml

jobs:

# TODO we basically need to:
#
# 1) cd src/tests/src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet
# 2) docker build -t grpc-server -f testassets/InteropTestsWebsite .
# 3) docker run --name grpc-server -d -p 50052:50052 -p 80:80 grpc-server
# 4) adb reverse tcp:50052 tcp:50052; adb reverse tcp:80 tcp:80
# 5) dotnet build -t:Run -p:Configuration=Release ../Android.Device_Emulator.gRPC.Test.csproj
# 6) ... expect the result to be 42
# 7) docker stop grpc-server (if we care)
#
# so... 1-4) are helix pre-scripts, 5) is the main command, 7) is helix post-script?

#
# Android devices
# Build the whole product using Mono and run libraries tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
# TODO which job template?
# jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
# - Android_arm TODO do we need/want it?
- Android_arm64
jobParameters:
testGroup: innerloop
nameSuffix: AllSubsets_Mono # TODO ???
# we don't want to build the whole .net
# buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAdditionalTimezoneChecks=true
timeoutInMinutes: 180
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)

# TODO Android_x64, Android_x86 - do those queues have docker?
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app

# Copy everything
COPY . ./
RUN dotnet --info
RUN dotnet restore testassets/InteropTestsWebsite
RUN dotnet publish testassets/InteropTestsWebsite --framework net6.0 -c Release -o out -p:LatestFramework=true

# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "InteropTestsWebsite.dll", "--port_http1", "80"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
<ImplicitUsings>enable</ImplicitUsings>

<!-- 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>

<ItemGroup>
<Compile Include="..\Shared\AsyncStreamExtensions.cs" Link="AsyncStreamExtensions.cs" />

<Protobuf Include="..\Proto\grpc\testing\test.proto" GrpcServices="Server" Link="Protos\test.proto" />
<Protobuf Include="..\Proto\grpc\testing\empty.proto" GrpcServices="None" Link="Protos\empty.proto" />
<Protobuf Include="..\Proto\grpc\testing\messages.proto" GrpcServices="None" Link="Protos\messages.proto" />

<None Include="..\Certs\InteropTests\*.*" LinkBase="Certs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

<PackageReference Include="Grpc.AspNetCore" Version="2.46.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.46.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#region Copyright notice and license

// 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.

#endregion

using Microsoft.AspNetCore.Server.Kestrel.Core;

namespace InteropTestsWebsite
{
public class Program
{
private const LogLevel MinimumLogLevel = LogLevel.Debug;

public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}

public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddLogging(builder => builder.SetMinimumLevel(MinimumLogLevel));
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel((context, options) =>
{
// Support --port and --use_tls cmdline arguments normally supported
// by gRPC interop servers.
var http2Port = context.Configuration.GetValue<int>("port", 50052);
var http1Port = context.Configuration.GetValue<int>("port_http1", -1);
var http3Port = context.Configuration.GetValue<int>("port_http3", -1);
var useTls = context.Configuration.GetValue<bool>("use_tls", false);

options.Limits.MinRequestBodyDataRate = null;
options.ListenAnyIP(http2Port, o => ConfigureEndpoint(o, useTls, HttpProtocols.Http2));
if (http1Port != -1)
{
options.ListenAnyIP(http1Port, o => ConfigureEndpoint(o, useTls, HttpProtocols.Http1));
}
if (http3Port != -1)
{
#pragma warning disable CA2252 // This API requires opting into preview features
options.ListenAnyIP(http3Port, o => ConfigureEndpoint(o, useTls, HttpProtocols.Http3));
#pragma warning restore CA2252 // This API requires opting into preview features
}

void ConfigureEndpoint(ListenOptions listenOptions, bool useTls, HttpProtocols httpProtocols)
{
Console.WriteLine($"Enabling connection encryption: {useTls}");

if (useTls)
{
var basePath = Path.GetDirectoryName(typeof(Program).Assembly.Location);
var certPath = Path.Combine(basePath!, "Certs", "server1.pfx");

listenOptions.UseHttps(certPath, "1111");
}
listenOptions.Protocols = httpProtocols;
}
});
webBuilder.UseStartup<Startup>();
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Running Grpc.Core interop client against Grpc.AspNetCore.Server interop server.
Context: https://github.com/grpc/grpc/blob/master/doc/interop-test-descriptions.md

## Start the InteropTestsWebsite

```
# From this directory
$ dotnet run
Now listening on: http://localhost:50052
```

## Build gRPC C# as a developer:
Follow https://github.com/grpc/grpc/tree/master/src/csharp
```
python tools/run_tests/run_tests.py -l csharp -c dbg --build_only
```

## Running the interop client

```
cd src/csharp/Grpc.IntegrationTesting.Client/bin/Debug/net45

mono Grpc.IntegrationTesting.Client.exe --server_host=localhost --server_port=50052 --test_case=large_unary
```

NOTE: Currently the some tests will fail because not all the features are implemented
by Grpc.AspNetCore.Server
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#region Copyright notice and license

// 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.

#endregion

using Grpc.Testing;

namespace InteropTestsWebsite
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddGrpc();
services.AddCors(o =>
{
o.AddPolicy("InteropTests", builder =>
{
builder.AllowAnyOrigin();
builder.AllowAnyMethod();
builder.AllowAnyHeader();
builder.WithExposedHeaders("Grpc-Status", "Grpc-Message", "Grpc-Encoding", "Grpc-Accept-Encoding", "x-grpc-test-echo-initial", "x-grpc-test-echo-trailing-bin");
});
});
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseCors();
app.UseGrpcWeb();
app.UseEndpoints(endpoints =>
{
endpoints.MapGrpcService<TestServiceImpl>().RequireCors("InteropTests").EnableGrpcWeb();
});
}
}
}
Loading