[Tests] Truncated SQLite last insert ID to real DB integer value #421
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.



Related PRs:
TL;DR;
I've truncated the value of SQLite virtual sequence numbers up to
2147483647max, given the risk of that change is minimal as it applies to SQLite-based test setup only. We don't support SQLite on production envs.Description:
Some time ago we've changed the way virtual sequence number for SQLite gateway used for test purposes only is computed. We've changed it from a
SELECT MAXexpression tohrtimeto simulate better a serial sequence.There's one issue with that, visible for a few weeks now on 4.6+ product-catalog CI. The number generated by
hrtimeis too large. While for SQLiteINTtype it's okay (< 9223372036854775807), for other databasesINT is a number smaller than2147483647, contrary toBIGINT. For the most identity keys with serial / auto-incremented sequence we useINT` (content language table is an exception).Therefore the change.
Roads not taken
The issue actually surfaces in product-catalog for GraphQL queries as:
We define almost all database IDs as
Int, which for GraphQL is within range of -2147483647 to 2147483647. I tried to useIDtype for that, but it's cast to int, making all schema validation fail, as we expect integers there.Alternatively we could introduce our own DbID or IbxID, however production-wise this doesn't make sense, as production is running on PostgreSQL and MySQL which
INTtype is of that smaller range.TODO