From f936d95e51db65c885c23961f6f9cb3c7033aa3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Gurhem?= Date: Mon, 18 Dec 2023 17:57:37 +0100 Subject: [PATCH] feat: implement healt check service in mock --- packages/csharp/ArmoniK.Api.Mock/Program.cs | 1 + .../ArmoniK.Api.Mock/Services/HealthChecks.cs | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 packages/csharp/ArmoniK.Api.Mock/Services/HealthChecks.cs diff --git a/packages/csharp/ArmoniK.Api.Mock/Program.cs b/packages/csharp/ArmoniK.Api.Mock/Program.cs index 2aa6effd2..afc5dc583 100644 --- a/packages/csharp/ArmoniK.Api.Mock/Program.cs +++ b/packages/csharp/ArmoniK.Api.Mock/Program.cs @@ -79,6 +79,7 @@ app.MapGrpcService(); app.MapGrpcService(); app.MapGrpcService(); +app.MapGrpcService(); app.MapGrpcService(); app.MapGrpcService(); app.MapGrpcService(); diff --git a/packages/csharp/ArmoniK.Api.Mock/Services/HealthChecks.cs b/packages/csharp/ArmoniK.Api.Mock/Services/HealthChecks.cs new file mode 100644 index 000000000..109711160 --- /dev/null +++ b/packages/csharp/ArmoniK.Api.Mock/Services/HealthChecks.cs @@ -0,0 +1,43 @@ +// This file is part of the ArmoniK project +// +// Copyright (C) ANEO, 2021-2023.All rights reserved. +// +// 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. + +using System.Threading.Tasks; + +using ArmoniK.Api.gRPC.V1.HealthChecks; + +using Grpc.Core; + +namespace ArmoniK.Api.Mock.Services; + +[Counting] +public class HealthChecks : HealthChecksService.HealthChecksServiceBase +{ + [Count] + public override Task CheckHealth(CheckHealthRequest request, + ServerCallContext context) + => Task.FromResult(new CheckHealthResponse + { + Services = + { + new CheckHealthResponse.Types.ServiceHealth + { + Healthy = HealthStatusEnum.Healthy, + Message = "Mock is healthy", + Name = "mock", + }, + }, + }); +}