From ceef7953b3963ea210d92092aebd23a9a33680c3 Mon Sep 17 00:00:00 2001 From: Pablo Aguilar Date: Thu, 25 Jul 2024 23:24:05 -0300 Subject: [PATCH] chore: return an empty metadata Signed-off-by: Pablo Aguilar --- internal/server/ofrep/evaluation.go | 10 ++++++---- internal/server/ofrep/evaluation_test.go | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/internal/server/ofrep/evaluation.go b/internal/server/ofrep/evaluation.go index c7ba15bcd8..40830eecbb 100644 --- a/internal/server/ofrep/evaluation.go +++ b/internal/server/ofrep/evaluation.go @@ -2,6 +2,7 @@ package ofrep import ( "context" + flipterrors "go.flipt.io/flipt/errors" "go.uber.org/zap" @@ -46,10 +47,11 @@ func (s *Server) EvaluateFlag(ctx context.Context, r *ofrep.EvaluateFlagRequest) } resp := &ofrep.EvaluatedFlag{ - Key: output.FlagKey, - Reason: transformReason(output.Reason), - Variant: output.Variant, - Value: value, + Key: output.FlagKey, + Reason: transformReason(output.Reason), + Variant: output.Variant, + Value: value, + Metadata: &structpb.Struct{Fields: make(map[string]*structpb.Value)}, } s.logger.Debug("ofrep variant", zap.Stringer("response", resp)) diff --git a/internal/server/ofrep/evaluation_test.go b/internal/server/ofrep/evaluation_test.go index 4f9d6bc81f..01ac8026ec 100644 --- a/internal/server/ofrep/evaluation_test.go +++ b/internal/server/ofrep/evaluation_test.go @@ -2,10 +2,11 @@ package ofrep import ( "context" + "testing" + "github.com/stretchr/testify/mock" flipterrors "go.flipt.io/flipt/errors" "google.golang.org/grpc/codes" - "testing" "google.golang.org/grpc/metadata" @@ -24,10 +25,11 @@ func TestEvaluateFlag_Success(t *testing.T) { ctx := context.TODO() flagKey := "flag-key" expectedResponse := &ofrep.EvaluatedFlag{ - Key: flagKey, - Reason: ofrep.EvaluateReason_DEFAULT, - Variant: "false", - Value: structpb.NewBoolValue(false), + Key: flagKey, + Reason: ofrep.EvaluateReason_DEFAULT, + Variant: "false", + Value: structpb.NewBoolValue(false), + Metadata: &structpb.Struct{Fields: make(map[string]*structpb.Value)}, } bridge := &bridgeMock{} s := New(zaptest.NewLogger(t), config.CacheConfig{}, bridge) @@ -62,10 +64,11 @@ func TestEvaluateFlag_Success(t *testing.T) { })) flagKey := "flag-key" expectedResponse := &ofrep.EvaluatedFlag{ - Key: flagKey, - Reason: ofrep.EvaluateReason_DISABLED, - Variant: "true", - Value: structpb.NewBoolValue(true), + Key: flagKey, + Reason: ofrep.EvaluateReason_DISABLED, + Variant: "true", + Value: structpb.NewBoolValue(true), + Metadata: &structpb.Struct{Fields: make(map[string]*structpb.Value)}, } bridge := &bridgeMock{} s := New(zaptest.NewLogger(t), config.CacheConfig{}, bridge)