Skip to content

Flaky test_geo* #39

Closed
Closed
@aiven-sal

Description

@aiven-sal

Some tests that match test_geo* in tests/test_commands.py and tests/test_asyncio/test_commands.py are not reliable.
We never observed them failing in CI or locally, but I received reports that they failed in some occasions.

These tests expect exact matches between floats e.g.

def test_geopos(self, r):
values = (2.1909389952632, 41.433791470673, "place1") + (
2.1873744593677,
41.406342043777,
"place2",
)
r.geoadd("barcelona", values)
# valkey uses 52 bits precision, hereby small errors may be introduced.
assert_resp_response(
r,
r.geopos("barcelona", "place1", "place2"),
[
(2.19093829393386841, 41.43379028184083523),
(2.18737632036209106, 41.40634178640635099),
],
[
[2.19093829393386841, 41.43379028184083523],
[2.18737632036209106, 41.40634178640635099],
],
)

And this doesn't always work.

According to the reports I received, the values are usually off by ~1e-15

Floats should be compared using math.isclose. The default tolerance should be enough.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions