Skip to content

Commit 0274025

Browse files
authored
Add tests for Vector Collection backup config (#711)
Add tests for setting Vector Collection `backup_count` and `async_backup_count` configuration.
1 parent a5fd26f commit 0274025

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

hazelcast/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "5.5.0"
1+
__version__ = "6.0.0"
22

33
# Set the default handler to "hazelcast" loggers
44
# to avoid "No handlers could be found" warnings.

tests/integration/backward_compatible/proxy/vector_collection_test.py

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,31 @@ def test_size(self):
174174
self.vector_collection.clear()
175175
self.assertEqual(self.vector_collection.size(), 0)
176176

177-
def test_backupCount_valid_values_pass(self):
177+
def test_backup_count_valid_values_pass(self):
178178
skip_if_client_version_older_than(self, "6.0")
179179
name = random_string()
180180
self.client.create_vector_collection_config(
181181
name, [IndexConfig("vector", Metric.COSINE, 3)], backup_count=2, async_backup_count=2
182182
)
183+
self.client.get_vector_collection(name).blocking()
183184

184-
def test_backupCount(self):
185+
def test_backup_count_max_value_pass(self):
186+
skip_if_client_version_older_than(self, "6.0")
187+
name = random_string()
188+
self.client.create_vector_collection_config(
189+
name, [IndexConfig("vector", Metric.COSINE, 3)], backup_count=6
190+
)
191+
self.client.get_vector_collection(name).blocking()
192+
193+
def test_backup_count_min_value_pass(self):
194+
skip_if_client_version_older_than(self, "6.0")
195+
name = random_string()
196+
self.client.create_vector_collection_config(
197+
name, [IndexConfig("vector", Metric.COSINE, 3)], backup_count=0
198+
)
199+
self.client.get_vector_collection(name).blocking()
200+
201+
def test_backup_count_more_than_max_value_fail(self):
185202
skip_if_server_version_older_than(self, self.client, "6.0")
186203
name = random_string()
187204
# check that the parameter is used by ensuring that it is validated on server side
@@ -194,7 +211,34 @@ def test_backupCount(self):
194211
async_backup_count=0,
195212
)
196213

197-
def test_asyncBackupCount(self):
214+
def test_backup_count_less_than_min_value_fail(self):
215+
skip_if_server_version_older_than(self, self.client, "6.0")
216+
name = random_string()
217+
with self.assertRaises(hazelcast.errors.IllegalArgumentError):
218+
self.client.create_vector_collection_config(
219+
name, [IndexConfig("vector", Metric.COSINE, 3)], backup_count=-1
220+
)
221+
222+
def test_async_backup_count_max_value_pass(self):
223+
skip_if_client_version_older_than(self, "6.0")
224+
name = random_string()
225+
self.client.create_vector_collection_config(
226+
name,
227+
[IndexConfig("vector", Metric.COSINE, 3)],
228+
backup_count=0,
229+
async_backup_count=6,
230+
)
231+
self.client.get_vector_collection(name).blocking()
232+
233+
def test_async_backup_count_min_value_pass(self):
234+
skip_if_client_version_older_than(self, "6.0")
235+
name = random_string()
236+
self.client.create_vector_collection_config(
237+
name, [IndexConfig("vector", Metric.COSINE, 3)], async_backup_count=0
238+
)
239+
self.client.get_vector_collection(name).blocking()
240+
241+
def test_async_backup_count_more_than_max_value_fail(self):
198242
skip_if_server_version_older_than(self, self.client, "6.0")
199243
name = random_string()
200244
# check that the parameter is used by ensuring that it is validated on server side
@@ -207,6 +251,27 @@ def test_asyncBackupCount(self):
207251
async_backup_count=7,
208252
)
209253

254+
def test_async_backup_count_less_than_min_value_fail(self):
255+
skip_if_server_version_older_than(self, self.client, "6.0")
256+
name = random_string()
257+
with self.assertRaises(hazelcast.errors.IllegalArgumentError):
258+
self.client.create_vector_collection_config(
259+
name,
260+
[IndexConfig("vector", Metric.COSINE, 3)],
261+
async_backup_count=-1,
262+
)
263+
264+
def test_sync_and_async_backup_count_more_than_max_value_fail(self):
265+
skip_if_server_version_older_than(self, self.client, "6.0")
266+
name = random_string()
267+
with self.assertRaises(hazelcast.errors.IllegalArgumentError):
268+
self.client.create_vector_collection_config(
269+
name,
270+
[IndexConfig("vector", Metric.COSINE, 3)],
271+
backup_count=4,
272+
async_backup_count=3,
273+
)
274+
210275
def assert_document_equal(self, doc1, doc2) -> None:
211276
self.assertEqual(doc1.value, doc2.value)
212277
self.assertEqual(len(doc1.vectors), len(doc2.vectors))

0 commit comments

Comments
 (0)