Skip to content

Commit

Permalink
[CLIENT-3118] Fix failing tests when running against server 7.2 (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 authored Sep 16, 2024
1 parent 79509c5 commit 0dad411
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions test/new_tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,14 @@ def test_create_string_index_with_correct_parameters_ns_length_extra(self):
ns_name = "a" * 50
policy = {}

with pytest.raises(e.InvalidRequest) as err_info:
with pytest.raises((e.InvalidRequest, e.NamespaceNotFound)) as err_info:
self.as_connection.index_string_create(ns_name, "demo", "name", "name_index", policy)

err_code = err_info.value.code
assert err_code is AerospikeStatus.AEROSPIKE_ERR_REQUEST_INVALID
if (TestBaseClass.major_ver, TestBaseClass.minor_ver) >= (7, 2):
assert err_code is AerospikeStatus.AEROSPIKE_ERR_NAMESPACE_NOT_FOUND
else:
assert err_code is AerospikeStatus.AEROSPIKE_ERR_REQUEST_INVALID

def test_create_string_index_with_incorrect_namespace(self):
"""
Expand Down
9 changes: 6 additions & 3 deletions test/new_tests/test_mapkeys_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,19 @@ def test_mapkeysindex_with_correct_parameters_string_on_numerickeys(self):
),
ids=("ns too long", "set too long", "bin too long", "index name too long"),
)
def test_mapkeys_with_parameters_too_long(self, ns, test_set, test_bin, index_name):
def test_mapkeys_with_parameters_too_long(self, ns, test_set, test_bin, index_name, request):
# Invoke index_map_keys_create() with correct arguments and set
# length extra
policy = {}

with pytest.raises(e.InvalidRequest) as err_info:
with pytest.raises((e.InvalidRequest, e.NamespaceNotFound)) as err_info:
self.as_connection.index_map_keys_create(ns, test_set, test_bin, aerospike.INDEX_STRING, index_name, policy)

err_code = err_info.value.code
assert err_code == AerospikeStatus.AEROSPIKE_ERR_REQUEST_INVALID
if request.node.callspec.id == "ns too long" and (TestBaseClass.major_ver, TestBaseClass.minor_ver) >= (7, 2):
assert err_code is AerospikeStatus.AEROSPIKE_ERR_NAMESPACE_NOT_FOUND
else:
assert err_code is AerospikeStatus.AEROSPIKE_ERR_REQUEST_INVALID

def test_mapkeysindex_with_incorrect_namespace(self):
"""
Expand Down

0 comments on commit 0dad411

Please sign in to comment.