Skip to content

Commit

Permalink
Fixes 5034: update latest snapshot after uploading content (#902)
Browse files Browse the repository at this point in the history
Fixes 5034: trigger update-latest-snapshot after uploading content
  • Loading branch information
xbhouse authored Nov 22, 2024
1 parent d8a6297 commit 7a63415
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/handler/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ func (rh *RepositoryHandler) enqueueAddUploadsEvent(c echo.Context, response api
if err := rh.DaoRegistry.RepositoryConfig.UpdateLastSnapshotTask(c.Request().Context(), taskID.String(), response.OrgID, response.RepositoryUUID); err != nil {
logger.Error().Err(err).Msgf("error UpdatingLastSnapshotTask task for AddUploads")
}
rh.enqueueUpdateLatestSnapshotEvent(c, response.OrgID, taskID, response)
}

return taskID.String()
Expand Down
9 changes: 9 additions & 0 deletions pkg/handler/repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ func mockTaskClientEnqueueAddUploads(repoSuite *ReposSuite, repo api.RepositoryR
repo.OrgID,
repo.RepositoryUUID,
).Return(nil)
repo.LastSnapshotTaskUUID = "00000000-0000-0000-0000-000000000000"
repoSuite.tcMock.On("Enqueue", queue.Task{
Typename: config.UpdateLatestSnapshotTask,
Payload: tasks.UpdateLatestSnapshotPayload{RepositoryConfigUUID: repo.UUID},
Dependencies: []uuid.UUID{dao.UuidifyString(repo.LastSnapshotTaskUUID)},
ObjectUUID: &repo.RepositoryUUID,
ObjectType: utils.Ptr(config.ObjectTypeRepository),
OrgId: repo.OrgID,
}).Return(nil, nil)
}

func mockSnapshotDeleteEvent(tcMock *client.MockTaskClient, repoConfigUUID string) {
Expand Down

0 comments on commit 7a63415

Please sign in to comment.