(2967) Generate unique references in organisation factory #2272
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes in this PR
unique
feature to guarantee unique strings for theiati_reference
andbeis_organisation_reference
in the organisation factory.We have seen the test suite fail with an intermittent failure, unrelated to actual code failure, caused by the organisation created failing the uniqueness check for its
iati_reference
:E.g. https://github.com/UKGovernmentBEIS/beis-report-official-development-assistance/actions/runs/6978961311/job/18991313569
We suspect this intermittent failure is caused by Faker's pseudo-random generator accidentally producing the same string within the same spec. The IATI reference and BEIS organisation reference are more susceptible to this, because the randomly generated sequences are only 5 characters long.
Using Faker's unique feature means it's also a good idea to clear the record of unique values that have been returned between each spec, to avoid running out of combinations. (Not statistically likely, but why take chances?)
Screenshots of UI changes
N/A
Next steps
CHANGELOG.md
, unless this PR is a small tweak which has no impact outside the development team.