Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into CLIENT-3106-map-err-co…
Browse files Browse the repository at this point in the history
…de-to-exc
  • Loading branch information
juliannguyen4 committed Sep 16, 2024
2 parents b1925bf + bcd9f46 commit d1ecbb8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
15.0.1rc5.dev3
15.0.1rc5.dev5
1 change: 1 addition & 0 deletions src/main/exception.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ PyObject *AerospikeException_New(void)

PyObject *py_code = NULL;
if (exception_def.code == NO_ERROR_CODE) {
Py_INCREF(Py_None);
py_code = Py_None;
}
else {
Expand Down
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 d1ecbb8

Please sign in to comment.