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

Respect completed_at timestamp in order factories #4168

Merged
merged 2 commits into from
Sep 17, 2021

Conversation

DianeLooney
Copy link
Contributor

@DianeLooney DianeLooney commented Sep 14, 2021

The order factories that automatically complete orders previously used
Time.current when setting the completed_at timestamp. For developers who want
to pre-date their order completions, this can be confusing. This change allows
orders to be cleanly pre-dated in this way.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

@DianeLooney DianeLooney changed the title Update order factory to respect supplied completed_at timestamps Update order factory to use completed_at timestamps Sep 14, 2021
@DianeLooney DianeLooney changed the title Update order factory to use completed_at timestamps Update order factory to respect completed_at timestamps Sep 14, 2021
@DianeLooney DianeLooney changed the title Update order factory to respect completed_at timestamps Update order factories to respect completed_at timestamps Sep 14, 2021
@DianeLooney DianeLooney changed the title Update order factories to respect completed_at timestamps Respect completed_at timestamp in order factories Sep 14, 2021
@DianeLooney DianeLooney marked this pull request as ready for review September 14, 2021 17:12
The order factories that automatically complete orders previously used
Time.current when setting the completed_at timestamp. For developers who want
to pre-date their order completions, this can be confusing. This change allows
orders to be cleanly pre-dated in this way.
@DianeLooney
Copy link
Contributor Author

Mysql tests failed because I was too granular with my timestamp comparison. I updated it to 5 seconds and force-pushed the fix. Sorry if anyone happened to catch the review super early!

@DianeLooney
Copy link
Contributor Author

The failing postgres test looks like spec flake to me, I can reproduce it locally by .reverseing the expected value. I'll open up a fix in another PR while I'm at it.

@DianeLooney
Copy link
Contributor Author

#4169

Happy to simply rebase if/when this is merged, or if someone with ci powers wants to re-run for me I'd be happy with that too.

Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

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

Looks good, though 5 seconds is probably excessive.

A five second window was previously stored. A 1s window is too small because it might occur at the rollover to a new second, and mysql could flake on this. So, a two second window is appropriately small while still accounting for timestamps being truncated when stored.

For example
* Clock reads xx:yy:01.995
* Factory runs
* MySQL stores xx:yy:01.000
* Clock now reads xx:yy:02.005
* Compare timestamps, 1.005s difference, test fails
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@kennyadsl kennyadsl merged commit 8e8d8cb into solidusio:master Sep 17, 2021
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.

4 participants