From 68d91f6f27e544963f0f2859b557eaeff571969f Mon Sep 17 00:00:00 2001 From: Evan Anderson Date: Fri, 20 Sep 2024 13:06:57 -0700 Subject: [PATCH] Fix data race in internal/entities/handlers/handler_test.go (#4566) --- internal/entities/handlers/handler_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/entities/handlers/handler_test.go b/internal/entities/handlers/handler_test.go index e26002dd31..d11f4555e4 100644 --- a/internal/entities/handlers/handler_test.go +++ b/internal/entities/handlers/handler_test.go @@ -53,7 +53,7 @@ var ( repoName = "testorg/testrepo" pullName = "testorg/testrepo/789" - repoEwp = &models.EntityWithProperties{ + repoEwp = models.EntityWithProperties{ Entity: models.EntityInstance{ ID: repoID, Type: minderv1.Entity_ENTITY_REPOSITORIES, @@ -71,7 +71,7 @@ var ( properties.RepoPropertyIsFork: false, } - pullRequestEwp = &models.EntityWithProperties{ + pullRequestEwp = models.EntityWithProperties{ Entity: models.EntityInstance{ ID: pullRequestID, Type: minderv1.Entity_ENTITY_PULL_REQUESTS, @@ -116,14 +116,14 @@ func withSuccessfulGetEntityName(name string) func(providerMock) { } } -func buildEwp(t *testing.T, ewp *models.EntityWithProperties, propMap map[string]any) *models.EntityWithProperties { +func buildEwp(t *testing.T, ewp models.EntityWithProperties, propMap map[string]any) *models.EntityWithProperties { t.Helper() entProps, err := properties.NewProperties(propMap) require.NoError(t, err) ewp.Properties = entProps - return ewp + return &ewp } func checkRepoMessage(t *testing.T, msg *watermill.Message) { @@ -245,7 +245,7 @@ func TestRefreshEntityAndDoHandler_HandleRefreshEntityAndEval(t *testing.T) { providerHint: "github", setupPropSvcMocks: func() fixtures.MockPropertyServiceBuilder { return fixtures.NewMockPropertiesService( - fixtures.WithSuccessfulEntityByUpstreamHint(repoEwp, githubHint), + fixtures.WithSuccessfulEntityByUpstreamHint(&repoEwp, githubHint), fixtures.WithFailedRetrieveAllPropertiesForEntity(service.ErrEntityNotFound), ) }, @@ -261,7 +261,7 @@ func TestRefreshEntityAndDoHandler_HandleRefreshEntityAndEval(t *testing.T) { lookupType: minderv1.Entity_ENTITY_REPOSITORIES, setupPropSvcMocks: func() fixtures.MockPropertyServiceBuilder { return fixtures.NewMockPropertiesService( - fixtures.WithSuccessfulEntityByUpstreamHint(repoEwp, githubHint), + fixtures.WithSuccessfulEntityByUpstreamHint(&repoEwp, githubHint), fixtures.WithSuccessfulRetrieveAllPropertiesForEntity(), fixtures.WithFailedEntityWithPropertiesAsProto(errors.New("fart")), )