Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for package_.CreatePreservationTask() #901

Merged
merged 9 commits into from
Mar 28, 2024

Conversation

djjuhasz
Copy link
Collaborator

@djjuhasz djjuhasz commented Mar 28, 2024

Fixes #900

  • Split large files related to PreservationAction and PreservationTask entities into smaller files
  • Add a persistence.CreatePreservationTask() method, and add an implementation to the ent client
  • Call persistence.CreatePreservationTask() from package_.CreatePreservationTask() instead of using direct SQL queries
  • Add unit tests
  • Remove the persistence.eventManager service wrapper
  • Update the ent schema for the "preservation_action" and "preservation_task" tables to make the timestamps columns nullable

@djjuhasz djjuhasz linked an issue Mar 28, 2024 that may be closed by this pull request
Copy link

codecov bot commented Mar 28, 2024

Codecov Report

Attention: Patch coverage is 42.99363% with 179 lines in your changes are missing coverage. Please review.

Project coverage is 48.00%. Comparing base (f075824) to head (4420aa2).

❗ Current head 4420aa2 differs from pull request most recent head 049f105. Consider uploading reports for the commit 049f105 to get more accurate results

Files Patch % Lines
internal/enums/preservation_action.go 0.00% 66 Missing ⚠️
internal/package_/preservation_task.go 16.66% 45 Missing ⚠️
internal/enums/preservation_task.go 0.00% 37 Missing ⚠️
internal/persistence/ent/client/package.go 86.88% 4 Missing and 4 partials ⚠️
internal/workflow/local_activities.go 0.00% 8 Missing ⚠️
internal/a3m/a3m.go 0.00% 6 Missing ⚠️
internal/package_/preservation_action.go 0.00% 4 Missing ⚠️
...ternal/persistence/ent/client/preservation_task.go 92.59% 1 Missing and 1 partial ⚠️
internal/workflow/processing.go 88.23% 1 Missing and 1 partial ⚠️
internal/workflow/move.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #901      +/-   ##
==========================================
+ Coverage   47.11%   48.00%   +0.88%     
==========================================
  Files          96      101       +5     
  Lines        5383     5402      +19     
==========================================
+ Hits         2536     2593      +57     
+ Misses       2611     2571      -40     
- Partials      236      238       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@djjuhasz djjuhasz force-pushed the dev/issue-900-create-pres-task-tests branch from 8e9a086 to 4420aa2 Compare March 28, 2024 00:45
@sevein sevein self-requested a review March 28, 2024 10:06
Copy link
Contributor

@sevein sevein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@djjuhasz djjuhasz force-pushed the dev/issue-900-create-pres-task-tests branch from 4420aa2 to 780d2d1 Compare March 28, 2024 15:46
- Make the ent preservation_action `StartedAt` and `CompletedAt` columns
  nullable
- Make the ent preservation_task `StartedAt` and `CompletedAt` columns
  nullable
Split ent client package methods into a separate `package` file.
- Move `package_.PreservationTask` struct to
  `datatypes.PreservationTask` to avoid circular imports
- Move PreservationTask enums to the `enums` package to avoid circular
  imports
- Move PreservationAction struct to `datatypes` package
- Move PreservationAction enums to `enums` package
I originally intended the eventManager wrapper as layer to compose the
event and persistence services. With the switch to including the
persistence service in the package service, it is less work to compose
the event and persistence services in the package service and doesn't
require a separate service.
- Add `CreatePreservationTask()` to the ent client
- Add `CreatePreservationTask()` to the persistence service
- Regenerate the persistence service mocks
- Add a `convertPreservationTask()` function to convert a
  `db.PreservationTask` to a `datatype.PreservationTask` struct
Fixes #900

- Use `persistence.CreatePreservationTask()` instead of a SQL query in
  the package service
- Add a `preservationTaskToGoa()` function to convert
  `datatypes.PreservationTask` to a Goa `EnduroPackagePreservationTask`
  struct

[skip codecov]
@djjuhasz djjuhasz force-pushed the dev/issue-900-create-pres-task-tests branch from 780d2d1 to 9ac3b10 Compare March 28, 2024 15:46
@djjuhasz djjuhasz merged commit c9628c3 into main Mar 28, 2024
11 checks passed
@djjuhasz djjuhasz deleted the dev/issue-900-create-pres-task-tests branch March 28, 2024 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: "CreatePreservationTask" code has no tests
2 participants