Skip to content

Commit

Permalink
CI,GrpcClient,Tests: use HTTPS connection
Browse files Browse the repository at this point in the history
Use HTTPS connection for GRPC communtication.

Also added commands to CI that trust ASP.NET certificate on
Linux because otherwise GRPC communication fails.
  • Loading branch information
webwarrior-ws committed Feb 8, 2024
1 parent 52344a6 commit c4c2eaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
apt install --yes --no-install-recommends ca-certificates
apt install --yes --no-install-recommends dotnet8
# Trust ASP.NET Core HTTPS development certificate so that GRPC server can be contacted through HTTPS.
# HTTPS connection is used in end-to-end GRPC tests.
dotnet dev-certs https
sudo -E dotnet dev-certs https -ep /usr/local/share/ca-certificates/aspnet/https.crt --format PEM
sudo update-ca-certificates
- name: Restore nuget dependencies
run: dotnet restore
Expand Down
2 changes: 1 addition & 1 deletion src/FX.GrpcClient/Instance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Instance

public FXGrpcService.FXGrpcServiceClient Connect()
{
var channel = GrpcChannel.ForAddress($"http://{serverFqdn}:{Port}");
var channel = GrpcChannel.ForAddress($"https://{serverFqdn}:{HttpsPort}");
var client = new FXGrpcService.FXGrpcServiceClient(channel);
return client;
}
Expand Down
2 changes: 1 addition & 1 deletion src/FX.Tests/E2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private Process LaunchGrpcServer()
var solutionDir = (new DirectoryInfo(Environment.CurrentDirectory)).Parent?.Parent?.Parent?.Parent?.Parent;
var serviceExeDir = Path.Join(solutionDir.FullName, "src", "FX.GrpcService", "bin", "Debug", "net8.0");

var argsString = $"--urls http://localhost:{GrpcClient.Instance.Port}";
var argsString = $"--urls https://localhost:{GrpcClient.Instance.HttpsPort}";

if (OperatingSystem.IsWindows())
{
Expand Down

0 comments on commit c4c2eaf

Please sign in to comment.