From 4ee9f0c513e2f6c46a0ba82a700b1d969e22b63f Mon Sep 17 00:00:00 2001 From: Juliano Costa Date: Tue, 22 Oct 2024 10:47:11 +0200 Subject: [PATCH] [cartservice] Update cart service to fail when cartServiceFailure is enabled (#1748) * Update cart service to fail when cartServiceFailure is enabled * changelog --- CHANGELOG.md | 2 ++ src/cartservice/src/Dockerfile | 4 ++-- src/cartservice/src/cartservice.csproj | 20 ++++++++++---------- src/cartservice/src/services/CartService.cs | 3 +-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55f3f5e51..faa6dcfde8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ the release. ([#1733](https://github.com/open-telemetry/opentelemetry-demo/pull/1733)) * [chore] Move opensearch image version to .env file ([#1743](https://github.com/open-telemetry/opentelemetry-demo/pull/1743)) +* [cartservice] Update cart service to fail when cartServiceFailure is enabled + ([#1748](https://github.com/open-telemetry/opentelemetry-demo/pull/1748)) ## 1.11.1 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); }