From 0dad411e57b0b1fbaa7c2b2934600b4eefd53bd9 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:50:56 -0700 Subject: [PATCH] [CLIENT-3118] Fix failing tests when running against server 7.2 (#671) --- test/new_tests/test_index.py | 7 +++++-- test/new_tests/test_mapkeys_index.py | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/test/new_tests/test_index.py b/test/new_tests/test_index.py index abcef7283..c8c8fc19d 100644 --- a/test/new_tests/test_index.py +++ b/test/new_tests/test_index.py @@ -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): """ diff --git a/test/new_tests/test_mapkeys_index.py b/test/new_tests/test_mapkeys_index.py index 469e42f72..51cf307c3 100644 --- a/test/new_tests/test_mapkeys_index.py +++ b/test/new_tests/test_mapkeys_index.py @@ -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): """