From 8c8cb6a310a40612d6c8e3f6ea0edc68dfbf532d Mon Sep 17 00:00:00 2001 From: Juliano Costa Date: Mon, 21 Oct 2024 12:02:14 +0200 Subject: [PATCH] Update cart service to fail when cartServiceFailure is enabled --- src/cartservice/src/Dockerfile | 4 ++-- src/cartservice/src/cartservice.csproj | 20 ++++++++++---------- src/cartservice/src/services/CartService.cs | 3 +-- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/cartservice/src/Dockerfile b/src/cartservice/src/Dockerfile index e2a12e7e78..812213bd5b 100644 --- a/src/cartservice/src/Dockerfile +++ b/src/cartservice/src/Dockerfile @@ -15,7 +15,7 @@ # limitations under the License. # https://mcr.microsoft.com/v2/dotnet/sdk/tags/list -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.302 AS builder +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.403 AS builder ARG TARGETARCH WORKDIR /usr/src/app/ @@ -30,7 +30,7 @@ RUN dotnet publish ./src/cartservice.csproj -v d -r linux-musl-$TARGETARCH --no- # ----------------------------------------------------------------------------- # https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list -FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.6-alpine3.20 +FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.10-alpine3.20 WORKDIR /usr/src/app/ COPY --from=builder /cartservice/ ./ diff --git a/src/cartservice/src/cartservice.csproj b/src/cartservice/src/cartservice.csproj index ea7705e133..5b5e31373f 100644 --- a/src/cartservice/src/cartservice.csproj +++ b/src/cartservice/src/cartservice.csproj @@ -15,22 +15,22 @@ - - + + - - + + - - - - - - + + + + + + diff --git a/src/cartservice/src/services/CartService.cs b/src/cartservice/src/services/CartService.cs index ff0b32153a..7c16fce91d 100644 --- a/src/cartservice/src/services/CartService.cs +++ b/src/cartservice/src/services/CartService.cs @@ -62,8 +62,7 @@ public override async Task EmptyCart(EmptyCartRequest request, ServerCall try { - // Throw 1/10 of the time to simulate a failure when the feature flag is enabled - if (await _featureFlagHelper.GetBooleanValue("cartServiceFailure", false) && random.Next(10) == 0) + if (await _featureFlagHelper.GetBooleanValueAsync("cartServiceFailure", false)) { await _badCartStore.EmptyCartAsync(request.UserId); }