diff --git a/VERSION b/VERSION index fd2a01863..94ff29cc4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.0 +3.1.1 diff --git a/setup.py b/setup.py index 16510059f..ef352897e 100644 --- a/setup.py +++ b/setup.py @@ -72,7 +72,7 @@ def run(self): os.environ['ARCHFLAGS'] = '-arch x86_64' AEROSPIKE_C_VERSION = os.getenv('AEROSPIKE_C_VERSION') if not AEROSPIKE_C_VERSION: - AEROSPIKE_C_VERSION = '4.3.6' + AEROSPIKE_C_VERSION = '4.3.8' DOWNLOAD_C_CLIENT = os.getenv('DOWNLOAD_C_CLIENT') AEROSPIKE_C_HOME = os.getenv('AEROSPIKE_C_HOME') PREFIX = None diff --git a/src/main/aerospike.c b/src/main/aerospike.c index 3890e4243..8c544257a 100644 --- a/src/main/aerospike.c +++ b/src/main/aerospike.c @@ -93,7 +93,7 @@ AerospikeConstants operator_constants[] = { MOD_INIT(aerospike) { - const char version[8] = "3.1.0"; + const char version[8] = "3.1.1"; // Makes things "thread-safe" PyEval_InitThreads(); int i = 0; diff --git a/src/main/policy_config.c b/src/main/policy_config.c index b5995a639..949854051 100644 --- a/src/main/policy_config.c +++ b/src/main/policy_config.c @@ -564,7 +564,7 @@ as_status set_optional_key(as_policy_key* target_ptr, PyObject* py_policy, const } uint32_t out_uint32; - as_status status = get_uint32_value(py_policy, &out_uint32); + as_status status = get_uint32_value(py_policy_val, &out_uint32); if (status != AEROSPIKE_OK) { return status; } @@ -584,7 +584,7 @@ as_status set_optional_replica(as_policy_replica* target_ptr, PyObject* py_polic } uint32_t out_uint32; - as_status status = get_uint32_value(py_policy, &out_uint32); + as_status status = get_uint32_value(py_policy_val, &out_uint32); if (status != AEROSPIKE_OK) { return status; } @@ -604,7 +604,7 @@ as_status set_optional_commit_level(as_policy_commit_level* target_ptr, PyObject } uint32_t out_uint32; - as_status status = get_uint32_value(py_policy, &out_uint32); + as_status status = get_uint32_value(py_policy_val, &out_uint32); if (status != AEROSPIKE_OK) { return status; } @@ -624,7 +624,7 @@ as_status set_optional_consistency_level(as_policy_consistency_level* target_ptr } uint32_t out_uint32; - as_status status = get_uint32_value(py_policy, &out_uint32); + as_status status = get_uint32_value(py_policy_val, &out_uint32); if (status != AEROSPIKE_OK) { return status; } @@ -644,7 +644,7 @@ as_status set_optional_gen(as_policy_gen* target_ptr, PyObject* py_policy, const } uint32_t out_uint32; - as_status status = get_uint32_value(py_policy, &out_uint32); + as_status status = get_uint32_value(py_policy_val, &out_uint32); if (status != AEROSPIKE_OK) { return status; } @@ -664,7 +664,7 @@ as_status set_optional_exists(as_policy_exists* target_ptr, PyObject* py_policy, } uint32_t out_uint32; - as_status status = get_uint32_value(py_policy, &out_uint32); + as_status status = get_uint32_value(py_policy_val, &out_uint32); if (status != AEROSPIKE_OK) { return status; } diff --git a/test/new_tests/test_base_class.py b/test/new_tests/test_base_class.py index beec5ee74..68397349a 100644 --- a/test/new_tests/test_base_class.py +++ b/test/new_tests/test_base_class.py @@ -53,7 +53,8 @@ def get_tls_info(): config.read("config.conf") if (config.has_option('tls', 'enable') and ( - config.getboolean('tls', 'enable'))): + config.get('tls', 'enable') != '' and + config.get('tls', 'enable') != '0')): TestBaseClass.using_tls = True tls_dict['enable'] = True diff --git a/test/new_tests/test_new_constructor.py b/test/new_tests/test_new_constructor.py new file mode 100644 index 000000000..5e50fd36d --- /dev/null +++ b/test/new_tests/test_new_constructor.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +import pytest +import sys +import json +from .test_base_class import TestBaseClass +from aerospike import exception as e + +host, user, password = TestBaseClass.get_hosts() +using_auth = user or password +aerospike = pytest.importorskip("aerospike") +try: + import aerospike +except: + print("Please install aerospike python client.") + sys.exit(1) + + +def test_setting_key(): + key_val = aerospike.POLICY_KEY_SEND + read_policy = {'key': key_val} + policies = {'read': read_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_consistency(): + cons_val = aerospike.POLICY_CONSISTENCY_ONE + read_policy = {'consistency_level': cons_val} + policies = {'read': read_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_consistency(): + replica_val = aerospike.POLICY_REPLICA_MASTER + read_policy = {'replica': replica_val} + policies = {'read': read_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_consistency(): + replica_val = aerospike.POLICY_REPLICA_MASTER + read_policy = {'replica': replica_val} + policies = {'read': read_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_conmmit_level(): + commit_val = aerospike.POLICY_COMMIT_LEVEL_ALL + write_policy = {'commit_level': commit_val} + policies = {'write': write_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_exists(): + exists_val = aerospike.POLICY_EXISTS_CREATE + write_policy = {'commit_level': exists_val} + policies = {'write': write_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_gen(): + gen_val = aerospike.POLICY_GEN_IGNORE + write_policy = {'commit_level': gen_val} + policies = {'write': write_policy} + config = {'hosts': host, 'policies': policies} + client = aerospike.client(config) + + +def test_setting_wrong_type(): + write_policy = {'commit_level': [1, 2, 3]} + policies = {'write': write_policy} + config = {'hosts': host, 'policies': policies} + with pytest.raises(e.ParamError): + client = aerospike.client(config)