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

chore: feat: add prev/nextPage to /potentialDuplicates DHIS2-19021 #20066

Merged
merged 12 commits into from
Feb 26, 2025

Conversation

teleivo
Copy link
Contributor

@teleivo teleivo commented Feb 25, 2025

  • add prev/nextPage to /potentialDuplicates
  • align service with our exporter services
    • remove getById
    • name get without byUid
    • throw NotFoundException in get
    • separate List and Page methods

Tests

Extract a TestSetup class from TrackerTest. TrackerTest is not composable. The exporter can be tested using test lifecycle class as most tests can share the same setup and are read only. Code like the deduplication service does read and write. This means we need full control of the test annotations. This is inline with the work we've done on removing the number of test base classes so annotations can live in the test classes themselves.

Duplicate TestSetup and Assertions classes so we can use them in our dhis-test-integration and dhis-test-web-api tests. There is no better way right now to share such code. We could only put it into main but we do not want to include test code in production code. The other option of adding it into dhis-support-test introduces cycles. We should revisit our test module arrangement at some point.

We can share JSON though via dhis-support-test (see tracker/simple_metadata.json and tracker/deduplication/potential_duplicates.json).

  • migrate deduplication controller test to postgres like we did for other tests
  • move test into correct package
  • use the tracker objects like we now do in exporter controller tests
    • add methods to TrackerObjects to find entities. We are already have them in TrackerBundle. We might be able to remove them when we move to using the importer using the actual importer JSON payload.
  • add potential duplicate specific TEs in tracker/deduplication/potential_duplicates.json. Note that the UIDs of the duplicate TEs match their tracker/event_and_enrollment.json counterpart expect for the D prefix.
  • align service test with our other tests in terms of naming and grouping of arrange, act and assert

Next

  • simplify view/Page and integrate types well PageRequestParams -> tracker/PageParams -> tracker/Page -> view/Page
  • handle requests to endpoints that do not support totalPages?
  • reuse TestSetup to setup metadata and data in tracker integration tests
  • reuse TestSetup to setup metadata and data in tracker web api tests
  • maybe use TE service inside of the deduplication service. I'll do that if there is time. Right now it's odd that the service accepts TEs that might not even exist. That logic is in the controller. ACL is definitely also not done with the same level of detail as in the exporter service 😓

@teleivo teleivo marked this pull request as ready for review February 25, 2025 15:47
@teleivo teleivo requested a review from a team as a code owner February 25, 2025 15:47
@teleivo teleivo changed the title chore: migrate test to postgres one DHIS2-19021 chore: align deduplication tests/service DHIS2-19021 Feb 25, 2025
@teleivo teleivo changed the title chore: align deduplication tests/service DHIS2-19021 chore: feat: add prev/nextPage to /potentialDuplicates DHIS2-19021 Feb 25, 2025
@teleivo teleivo force-pushed the DHIS2-19021-potential-duplicates branch from c6c2ad0 to c1ea262 Compare February 26, 2025 05:40
@teleivo teleivo force-pushed the DHIS2-19021-potential-duplicates branch from c1ea262 to 76abfc5 Compare February 26, 2025 05:54
@@ -0,0 +1,159 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

it's definitely easier to understand the potential duplicate tests if we use this json, but didn't we say we want to have one json for metadata and one for data only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure that every tests requirements should affect all other tests 😅 All the exporter tests we have of which there are many do not need these TEs.

@teleivo teleivo enabled auto-merge (squash) February 26, 2025 07:30
Copy link

@teleivo teleivo merged commit a672749 into master Feb 26, 2025
17 checks passed
@teleivo teleivo deleted the DHIS2-19021-potential-duplicates branch February 26, 2025 08:21
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.

3 participants