Skip to content

MODEXPW-651: buildContext_setsCreatedAt: Optional fractional second - #751

Closed
julianladisch wants to merge 2 commits into
masterfrom
MODEXPW-651
Closed

MODEXPW-651: buildContext_setsCreatedAt: Optional fractional second #751
julianladisch wants to merge 2 commits into
masterfrom
MODEXPW-651

Conversation

@julianladisch

Copy link
Copy Markdown
Contributor

https://folio-org.atlassian.net/browse/MODEXPW-651

Purpose

Avoid spurious test failures.

OrderEmailContextMapperTest.buildContext_setsCreatedAt:177 fails in about .1 % of all runs with this error:

Expecting actual:
  "2026-08-11T15:33:47Z"
to match pattern:
  "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z"

Example: https://github.com/folio-org/mod-data-export-worker/actions/runs/31503434083/job/93819003252

Approach

Fix the expected pattern by making the fractional second optional.

Pre-Merge Checklist:

Before merging this PR, please go through the following list and take appropriate actions.

  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • Check logging
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • n/a Were any API paths or methods changed, added or removed?
    • n/a Were there any schema changes?
    • n/a Did any of the interface versions change?
    • n/a Were permissions changed, added, or removed?
    • n/a Are there new interface dependencies?
    • There are no breaking changes in this PR.

…tedAt

https://folio-org.atlassian.net/browse/MODEXPW-651

OrderEmailContextMapperTest.buildContext_setsCreatedAt:177 fails in about .1 % of all runs with this error:

```
Expecting actual:
  "2026-08-11T15:33:47Z"
to match pattern:
  "\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z"
```

Example: https://github.com/folio-org/mod-data-export-worker/actions/runs/31503434083/job/93819003252

Fix the expected pattern by making the fractional second optional.
@markusweigelt

Copy link
Copy Markdown
Contributor

@julianladisch thanks for the investigation and the solution.

I don’t think fixing the test at this point is the ideal approach. The test is green after the change, but the result for createdAt is then inconsistent. IMO this could mean that we would potentially have to add additional conditions everywhere createdAt is used.

I would therefore prefer to focus on keeping the result of the implementation consistent at this point. I’ve implemented a proposal for this. https://github.com/slub/mod-data-export-worker/commits/MODEXPW-651

I can overwrite the changes of your branch or provide an alternative one. Alternatively, you can also cherry-pick the changes or simply copy them over.

If you have a better idea for the implementation, I’m of course open to that as well.

@sonarqubecloud

Copy link
Copy Markdown

@markusweigelt markusweigelt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The implementation should be changed instead of adjusting the tests.

@julianladisch

Copy link
Copy Markdown
Contributor Author

Agreed.

Closing this PR. Replaced with https://github.com/slub/mod-data-export-worker/commits/MODEXPW-651

@julianladisch
julianladisch deleted the MODEXPW-651 branch August 12, 2026 08:12
@julianladisch

Copy link
Copy Markdown
Contributor Author

Replacement PR: #752

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.

2 participants