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

Remove setting return cycle in ReturnLogHelper #1398

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

Cruikshanks
Copy link
Member

When attempting to run the acceptance tests we found most of them were now failing. After investigating we tracked it down to a recent change made to the ReturnLogHelper.

We started setting returnCycleId to a generated UUID. Normally, return logs have this set to the return cycle they fall within. However, if it is set (in the DB proper) the ID must exist in return.return_cycles.

We've opted not to replicate foreign key constraints in our test DB legacy migrations because of the additional complexity they would add to our unit tests, for something we don't need to cover in them.

It wasn't being set before, because our premise for the helpers is they set only what is required in order to insert a record. Any fields that are 'optional', are expected to be set within the test using the helper and passed in.

Fortunately, removing the call in the helper hasn't broken any existing tests, further highlighting we don't really need this defaulted for what we are testing. And removing the call gets the acceptance tests passing again!

When attempting to run the acceptance tests we found most of them were now failing. After investigating we tracked it down to a [recent change made](#1353) to the `ReturnLogHelper`.

We started setting `returnCycleId` to a generated UUID. Normally, return logs have this set to the return cycle they fall within. However, if it is set (in the DB proper) the ID _must_ exist in `return.return_cycles`.

We've opted not to replicate foreign key constraints in our test DB legacy migrations because of the additional complexity they would add to our unit tests, for something we don't need to cover in them.

It wasn't being set before, because our premise for the helpers is they set _only_ what is required in order to insert a record. Any fields that are 'optional', are expected to be set within the test using the helper and passed in.

Fortunately, removing the call in the helper hasn't broken any existing tests, further highlighting we don't really need this defaulted for what we are testing. And removing the call gets the acceptance tests passing again!
@Cruikshanks Cruikshanks added the housekeeping Refactoring, tidying up or other work which supports the project label Oct 10, 2024
@Cruikshanks Cruikshanks self-assigned this Oct 10, 2024
@Cruikshanks Cruikshanks marked this pull request as ready for review October 10, 2024 10:50
@Cruikshanks Cruikshanks merged commit e54d140 into main Oct 10, 2024
6 checks passed
@Cruikshanks Cruikshanks deleted the remove-setting-return-cycle-in-helper branch October 10, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants