Skip to content

Commit

Permalink
Fix data race in internal/entities/handlers/handler_test.go (#4566)
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson authored Sep 20, 2024
1 parent 6317e0c commit 68d91f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/entities/handlers/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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),
)
},
Expand All @@ -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")),
)
Expand Down

0 comments on commit 68d91f6

Please sign in to comment.