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

Unexpected ordering #39

Closed
maxcountryman opened this issue Sep 9, 2021 · 1 comment
Closed

Unexpected ordering #39

maxcountryman opened this issue Sep 9, 2021 · 1 comment

Comments

@maxcountryman
Copy link

Hi there, I'm trying to write a test that demonstrates the ULID ordering promises but am seeing some unexpected behavior every few test runs or so:

[src/models/id.rs:141] &id_0 = Ulid(1972003866952799546420484161793439825);
[src/models/id.rs:142] &id_1 = Ulid(1972003866952020694265156341296371228);
thread 'models::id::tests::test_ordering_monotonic' panicked at 'assertion failed: id_0 < id_1'

Most of the time this assertion is true but sometimes it isn't. The test is simply constructing two ULIDs one after the other and then asserting.

@dylanhart
Copy link
Owner

This assertion is only valid when Ulid instances are created by Generator since there is additional state that needs to be tracked in order to ensure that the ordering is valid.

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

No branches or pull requests

2 participants