I am working on a program that needs to work on values that are fetched from different database types: currently we support 12 different database types. My code applies some business logic to the values fetched from the database, a score is calculated and values are ordered. I have written tests for this business logic. Due to the differences of 10^-6 between values fetched from different databases, ordering changes depending on the database type. For production, I believe difference in ordering due to a difference of 10^-6 is acceptable. (Especially because we say the data integrity and quality is user's responsibility for our product.) Also, our tests for fetching values from dbs test up to a 10^-5 precision. What is the best way to test this ? Namely, ordering changes due to small differences in database type. Note.Two databases that give different results are Sqlite3 and MariaDB.


Are you asking about integration/e2e tests or unit tests? For unit tests, the precision returned shouldn't matter, since you're providing those values directly to the test.

If you're talking about integration or e2e tests, ideally you'd run against all your supported DBs (maybe in ephemeral environments against containerized persistence layers), then writing assertions that verify the system behaves the way you expect depending on the persistence layer seems prudent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.