From c9a3f1725c5084a133470c8ecc19451f6902d74f Mon Sep 17 00:00:00 2001 From: Sarvar Muminov Date: Mon, 27 Sep 2021 16:32:55 -0700 Subject: [PATCH] Fix context builder test failure --- server/events/project_command_context_builder.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/events/project_command_context_builder.go b/server/events/project_command_context_builder.go index a5906fa8fc..32917a4d02 100644 --- a/server/events/project_command_context_builder.go +++ b/server/events/project_command_context_builder.go @@ -16,17 +16,19 @@ func NewProjectCommandContextBulder(policyCheckEnabled bool, commentBuilder Comm CommentBuilder: commentBuilder, } + contextBuilderWithStats := &CommandScopedStatsProjectCommandContextBuilder{ + ProjectCommandContextBuilder: projectCommandContextBuilder, + ProjectCounter: scope.NewCounter("projects"), + } + if policyCheckEnabled { return &PolicyCheckProjectCommandContextBuilder{ CommentBuilder: commentBuilder, - ProjectCommandContextBuilder: projectCommandContextBuilder, + ProjectCommandContextBuilder: contextBuilderWithStats, } } - return &CommandScopedStatsProjectCommandContextBuilder{ - ProjectCommandContextBuilder: projectCommandContextBuilder, - ProjectCounter: scope.NewCounter("projects"), - } + return projectCommandContextBuilder } type ContextFlags struct { @@ -143,8 +145,8 @@ func (cb *DefaultProjectCommandContextBuilder) BuildProjectContext( } type PolicyCheckProjectCommandContextBuilder struct { - ProjectCommandContextBuilder *DefaultProjectCommandContextBuilder - CommentBuilder CommentBuilder + ProjectCommandContextBuilder + CommentBuilder CommentBuilder } func (cb *PolicyCheckProjectCommandContextBuilder) BuildProjectContext(