Skip to content

Commit 48376cb

Browse files
authored
Merge pull request #1325 from redis/update-cluster-tests
Update cluster assertions
2 parents 1448e2f + 12f24ba commit 48376cb

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

cluster/test/commands_on_geo_test.rb

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,20 @@ def test_geohash
2424

2525
def test_geopos
2626
add_sicily
27-
expected = [%w[13.36138933897018433 38.11555639549629859],
28-
%w[15.08726745843887329 37.50266842333162032],
29-
nil]
27+
28+
expected = if version >= "8.0"
29+
[
30+
%w[13.361389338970184 38.1155563954963],
31+
%w[15.087267458438873 37.50266842333162],
32+
nil,
33+
]
34+
else
35+
[
36+
%w[13.36138933897018433 38.11555639549629859],
37+
%w[15.08726745843887329 37.50266842333162032],
38+
nil,
39+
]
40+
end
3041
assert_equal expected, redis.geopos('Sicily', %w[Palermo Catania NonExisting])
3142
end
3243

@@ -43,12 +54,30 @@ def test_georadius
4354
expected = [%w[Palermo 190.4424], %w[Catania 56.4413]]
4455
assert_equal expected, redis.georadius('Sicily', 15, 37, 200, 'km', 'WITHDIST')
4556

46-
expected = [['Palermo', %w[13.36138933897018433 38.11555639549629859]],
47-
['Catania', %w[15.08726745843887329 37.50266842333162032]]]
57+
expected = if version >= "8.0"
58+
[
59+
['Palermo', %w[13.361389338970184 38.1155563954963]],
60+
['Catania', %w[15.087267458438873 37.50266842333162]],
61+
]
62+
else
63+
[
64+
['Palermo', %w[13.36138933897018433 38.11555639549629859]],
65+
['Catania', %w[15.08726745843887329 37.50266842333162032]],
66+
]
67+
end
4868
assert_equal expected, redis.georadius('Sicily', 15, 37, 200, 'km', 'WITHCOORD')
4969

50-
expected = [['Palermo', '190.4424', %w[13.36138933897018433 38.11555639549629859]],
51-
['Catania', '56.4413', %w[15.08726745843887329 37.50266842333162032]]]
70+
expected = if version >= "8.0"
71+
[
72+
['Palermo', '190.4424', %w[13.361389338970184 38.1155563954963]],
73+
['Catania', '56.4413', %w[15.087267458438873 37.50266842333162]],
74+
]
75+
else
76+
[
77+
['Palermo', '190.4424', %w[13.36138933897018433 38.11555639549629859]],
78+
['Catania', '56.4413', %w[15.08726745843887329 37.50266842333162032]],
79+
]
80+
end
5281
assert_equal expected, redis.georadius('Sicily', 15, 37, 200, 'km', 'WITHDIST', 'WITHCOORD')
5382
end
5483

0 commit comments

Comments
 (0)