Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
0cc611b
Fix command-level write, operate, batch_write, and scan policies not …
juliannguyen4 Aug 27, 2025
7eaaa1f
Deprecate meta parameter in client.put()
juliannguyen4 Aug 27, 2025
521e215
fix?
juliannguyen4 Aug 27, 2025
915678e
fix?
juliannguyen4 Aug 27, 2025
48453a9
fix?
juliannguyen4 Aug 27, 2025
0e2032c
fix client.remove_bin() not applying policy's ttl if meta.ttl is set …
juliannguyen4 Aug 27, 2025
138358f
dont init as_record twice
juliannguyen4 Aug 27, 2025
1b0c36f
put() is also initializing as_record twice
juliannguyen4 Aug 27, 2025
5062f5c
hard to deprecate function params. just add a note in function
juliannguyen4 Aug 27, 2025
1ca626e
fix mem leak if bins dictionary is invalid
juliannguyen4 Aug 27, 2025
35ca640
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Aug 28, 2025
33907e1
revert
juliannguyen4 Aug 28, 2025
a291e1a
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Sep 3, 2025
5c05df4
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Oct 7, 2025
cb7a07e
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Nov 3, 2025
9422ad2
Replace deprecation docstring with multiline var
juliannguyen4 Nov 4, 2025
add81e6
fix
juliannguyen4 Nov 4, 2025
fd3db45
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Nov 11, 2025
92325bf
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Dec 2, 2025
177c19c
Merge remote-tracking branch 'origin/dev' into CLIENT-3664-fix-write-…
juliannguyen4 Dec 5, 2025
826a914
WIP
juliannguyen4 Dec 5, 2025
b4809d7
Revert
juliannguyen4 Dec 5, 2025
e02c60c
Doc
juliannguyen4 Dec 5, 2025
fa973ae
test and see if deprecation shows up properly for aerospike_helpers.
juliannguyen4 Dec 5, 2025
4f649fe
Make more accurate for other commands that don't take in a write policy
juliannguyen4 Dec 5, 2025
d34d940
Finish updating aerospike_helpers
juliannguyen4 Dec 5, 2025
e52682d
Use macro
juliannguyen4 Dec 5, 2025
a88f237
This test will not fail if an invalid key is passed
juliannguyen4 Dec 5, 2025
142ad28
Rename to something better.
juliannguyen4 Dec 5, 2025
e33a7eb
socket_timeout isn't in docs
juliannguyen4 Dec 6, 2025
04b6584
Add more test cases for checking that warning is raised for using met…
juliannguyen4 Dec 6, 2025
08b3d90
Just undo to be consistent
juliannguyen4 Dec 8, 2025
ba6f07a
Merge remote-tracking branch 'origin/dev' into CLIENT-3947-deprecate-…
juliannguyen4 Feb 18, 2026
f23c7df
Merge remote-tracking branch 'origin/dev' into CLIENT-3947-deprecate-…
juliannguyen4 Feb 20, 2026
fa18901
Update version
juliannguyen4 Feb 20, 2026
99097b9
Fix missing allowed key for client config "policies"
juliannguyen4 Feb 21, 2026
a66a0cc
Fix missing allowed key for client config "policies"
juliannguyen4 Feb 21, 2026
1e79d2e
fix
juliannguyen4 Feb 21, 2026
61b5637
Fix doc for client.remove()
juliannguyen4 Feb 23, 2026
46aa535
Read BatchRecord shouldn't pass in a ttl since it shouldn't accept wr…
juliannguyen4 Feb 23, 2026
75ca6e6
Reuse macro to define number of lines in stack trace
juliannguyen4 Feb 23, 2026
a7b7a42
Add missing test case for client config option socket_timeout
juliannguyen4 Feb 23, 2026
b5c99d2
Only deprecate meta["ttl"], not the whole meta parameter
juliannguyen4 Feb 25, 2026
2d4b471
Add missing allowed key
juliannguyen4 Feb 25, 2026
a7c719c
Smoke tests: have pytest fail if an unhandled warning is raised
juliannguyen4 Feb 25, 2026
b026fd3
Address warnings
juliannguyen4 Feb 25, 2026
8d92320
Fix test not handling DeprecationWarning from operations.touch
juliannguyen4 Feb 25, 2026
1a8f297
Prevent unhandled warning
juliannguyen4 Feb 25, 2026
db5c6af
Merge remote-tracking branch 'origin/dev' into CLIENT-3947-deprecate-…
juliannguyen4 Feb 26, 2026
e9f3020
Just raise error for DeprecationWarnings specifically. Somehow raisin…
juliannguyen4 Feb 26, 2026
19e433a
Doc: fix index_cdt_create being listed under aerospike module instead…
juliannguyen4 Feb 26, 2026
ee81b6b
touch() on its own isn't deprecated, only the ttl parameter
juliannguyen4 Feb 26, 2026
60e7fa0
Handle bug where python client does not exit when it gives a warning …
juliannguyen4 Feb 26, 2026
4f00ff0
Revert
juliannguyen4 Feb 26, 2026
4524bf0
As a temporary workaround, ignore warnings from test_cdt_index.py
juliannguyen4 Feb 26, 2026
c893180
Test config level ttl for all APIs involved with this change except B…
juliannguyen4 Feb 26, 2026
ab6a28f
Explicitly test setting command level ttl option via meta parameter
juliannguyen4 Feb 26, 2026
45d071a
WIP replace all deprecated usages of meta['ttl'] with policy['ttl']
juliannguyen4 Feb 26, 2026
d92599f
finish replacing all deprecated usages of meta['ttl'] with policy['ttl']
juliannguyen4 Feb 26, 2026
a1beb8a
Fix test
juliannguyen4 Feb 26, 2026
72de955
Policy does not accept ttl as None. touch() will modify the ttl, so g…
juliannguyen4 Feb 27, 2026
a34d207
Fix remaining test failures. Known issue where batch_write's Write Ba…
juliannguyen4 Feb 27, 2026
3655fd9
Fix test
juliannguyen4 Feb 27, 2026
7a3c11d
Fix warning filter
juliannguyen4 Feb 27, 2026
f38f036
Remove xfails for test cases that aren't properly set up...
juliannguyen4 Feb 27, 2026
a7778b6
Fix positive test cases for client.remove()
juliannguyen4 Feb 27, 2026
f9fb235
test_remove.py: move away from deprecated meta['gen']
juliannguyen4 Feb 27, 2026
a798a60
Fix remove tests
juliannguyen4 Feb 27, 2026
c33ef1f
address more warnings in tests
juliannguyen4 Feb 27, 2026
e17d519
Fix test case
juliannguyen4 Feb 27, 2026
1bdcc6e
Fix test case
juliannguyen4 Feb 27, 2026
ed340fe
Forget checking the warning if it gets raised as a ClientError when -…
juliannguyen4 Feb 27, 2026
43d3627
Update tests using deprecated param
juliannguyen4 Feb 27, 2026
4484205
Fix remaining failing tests
juliannguyen4 Feb 27, 2026
6b4aa2d
Fix for google style docstrings
juliannguyen4 Feb 27, 2026
42fa603
Add test to cover using meta['gen'] in remove()
juliannguyen4 Feb 27, 2026
db5fa5e
Fix incorrect version changed date for deprecated methods
juliannguyen4 Feb 27, 2026
5ceb01a
WIP code review changes.
juliannguyen4 Feb 27, 2026
2e598c8
Add missing test case for client.append() using client config operate…
juliannguyen4 Feb 27, 2026
c98e035
Clear up in tests
juliannguyen4 Feb 27, 2026
0c2fdc7
test_batch_write_policy and test_scan_policy don't need to be paramet…
juliannguyen4 Feb 27, 2026
ecb7878
Move to pytest.warns() bc simpler to use
juliannguyen4 Feb 27, 2026
54284f1
Report code coverage for code path where -Werror is passed to python
juliannguyen4 Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
registry-username: ${{ env.REGISTRY_NAME == 'docker.io' && secrets.DOCKER_HUB_BOT_USERNAME || secrets.QE_DOCKER_REGISTRY_USERNAME }}
registry-password: ${{ env.REGISTRY_NAME == 'docker.io' && secrets.DOCKER_HUB_BOT_PW || secrets.QE_DOCKER_REGISTRY_PASSWORD }}

- run: python3 -m pytest --cov=aerospike_helpers --cov-report xml:coverage.xml ./new_tests
- run: python3 -m pytest -Werror --cov=aerospike_helpers --cov-report xml:coverage.xml ./new_tests
working-directory: test

- name: Copy over source files to build dir
Expand Down Expand Up @@ -306,7 +306,7 @@ jobs:
- name: Run tests
# We need to disable capturing output or else we cannot see memory errors reported by
# libasan during the test run
run: python -m pytest ./new_tests -vvs
run: python -m pytest ./new_tests -vvs -W error::DeprecationWarning
working-directory: test

test-ce:
Expand Down
5 changes: 5 additions & 0 deletions aerospike_helpers/batch/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def __init__(self, key: tuple) -> None:
class Write(BatchRecord):
""" Write is used for executing Batch write commands with batch_write and retrieving batch write results.

.. include:: ./deprecate_meta_ttl.rst

Attributes:
key (:obj:`tuple`): The aerospike key to send the command to.
record (:obj:`tuple`): The record corresponding to the requested key.
Expand Down Expand Up @@ -111,6 +113,9 @@ def __init__(
class Read(BatchRecord):
""" Read is used for executing Batch read commands with batch_write and retrieving results.

.. deprecated:: 19.1.0 Deprecated the ``"ttl"`` option in the ``meta`` parameter. Use the policy parameter in a
:py:obj:`~aerospike_helpers.batch.records.Write` BatchRecord to set the ``"ttl"`` instead.

Attributes:
key (:obj:`tuple`): The aerospike key to send the command to.
record (:obj:`tuple`): The record corresponding to the requested key.
Expand Down
6 changes: 3 additions & 3 deletions aerospike_helpers/operations/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ def increment(bin_name, amount):
def touch(ttl: Optional[int] = None):
"""Create a touch operation dictionary.

Using ttl here is deprecated. It should be set in the record metadata for the operate method.
Using ttl here is deprecated. It should be set in the policy parameter for the operate method.

Args:
ttl (int): Deprecated. The ttl that should be set for the record.
This should be set in the metadata passed to the operate or
This should be set in the policy parameter passed to the operate or
operate_ordered methods.
Returns:
A dictionary to be passed to operate or operate_ordered.
"""
op_dict = {"op": aerospike.OPERATOR_TOUCH}
if ttl:
warnings.warn("TTL should be specified in the meta dictionary for operate", DeprecationWarning)
warnings.warn("TTL should be specified in the policy parameter for operate", DeprecationWarning)
op_dict["val"] = ttl
return op_dict

Expand Down
58 changes: 40 additions & 18 deletions doc/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ Record Commands

Create a new record, or remove / add bins to a record.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param dict bins: contains bin name-value pairs of the record.
:param dict meta: record metadata to be set. see :ref:`metadata_dict`.
Expand Down Expand Up @@ -181,6 +183,8 @@ Record Commands
(In Aerospike server versions prior to 3.6.0, non-existent bins being read will have a \
:py:obj:`None` value. )

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param list list: See :ref:`aerospike_operation_helpers.operations`.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
Expand All @@ -207,6 +211,8 @@ Record Commands

Write operations or read operations that fail will not return a ``(bin-name, result)`` tuple.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param list list: See :ref:`aerospike_operation_helpers.operations`.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
Expand All @@ -224,6 +230,10 @@ Record Commands

Touch the given record, setting its time-to-live and incrementing its generation.

.. versionchanged:: 19.1.0

Deprecated the ``meta["ttl"]`` parameter. Use the ``val`` parameter instead.

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param int val: ttl in seconds, with ``0`` resolving to the default value in the server config.
:param dict meta: record metadata to be set. see :ref:`metadata_dict`
Expand All @@ -238,6 +248,10 @@ Record Commands

Remove a record matching the *key* from the cluster.

.. versionchanged:: 19.1.0

Deprecated the ``meta`` parameter. Use the policy parameter to set ``gen`` instead.

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param dict meta: contains the expected generation of the record in a key called ``"gen"``.
:param dict policy: see :ref:`aerospike_remove_policies`. May be passed as a keyword argument.
Expand All @@ -252,6 +266,8 @@ Record Commands
Remove a list of bins from a record with a given *key*. Equivalent to \
setting those bins to :meth:`aerospike.null` with a :meth:`~aerospike.put`.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` associated with the record.
:param list list: the bins names to be removed from the record.
:param dict meta: record metadata to be set. See :ref:`metadata_dict`.
Expand Down Expand Up @@ -408,6 +424,8 @@ String Operations

Append a string to the string value in bin.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` tuple associated with the record.
:param str bin: the name of the bin.
:param str val: the string to append to the bin value.
Expand All @@ -427,6 +445,8 @@ String Operations

Prepend the string value in *bin* with the string *val*.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` tuple associated with the record.
:param str bin: the name of the bin.
:param str val: the string to prepend to the bin value.
Expand Down Expand Up @@ -456,6 +476,8 @@ Numeric Operations

Increment the integer value in *bin* by the integer *val*.

.. include:: ./deprecate_meta_ttl.rst

:param tuple key: a :ref:`aerospike_key_tuple` tuple associated with the record.
:param str bin: the name of the bin.
:param int offset: the value by which to increment the value in *bin*.
Expand Down Expand Up @@ -946,7 +968,7 @@ Index Operations

.. method:: index_string_create(ns, set, bin, name[, policy: dict])

.. deprecated:: 20.0.0 :meth:`index_single_value_create` should be used instead.
.. deprecated:: 19.1.0 :meth:`index_single_value_create` should be used instead.

Create a string index with *index_name* on the *bin* in the specified \
*ns*, *set*.
Expand All @@ -960,7 +982,7 @@ Index Operations

.. method:: index_integer_create(ns, set, bin, name[, policy])

.. deprecated:: 20.0.0 :meth:`index_single_value_create` should be used instead.
.. deprecated:: 19.1.0 :meth:`index_single_value_create` should be used instead.

Create an integer index with *name* on the *bin* in the specified \
*ns*, *set*.
Expand All @@ -974,7 +996,7 @@ Index Operations

.. method:: index_blob_create(ns, set, bin, name[, policy])

.. deprecated:: 20.0.0 :meth:`index_single_value_create` should be used instead.
.. deprecated:: 19.1.0 :meth:`index_single_value_create` should be used instead.

Create a blob index with *name* on the *bin* in the specified \
*ns*, *set*.
Expand All @@ -988,7 +1010,7 @@ Index Operations

.. method:: index_geo2dsphere_create(ns, set, bin, name[, policy: dict])

.. deprecated:: 20.0.0 :meth:`index_single_value_create` should be used instead.
.. deprecated:: 19.1.0 :meth:`index_single_value_create` should be used instead.

Create a geospatial 2D spherical index with *name* on the *bin* \
in the specified *ns*, *set*.
Expand All @@ -1012,23 +1034,23 @@ Index Operations
client.index_geo2dsphere_create('test', 'pads', 'loc', 'pads_loc_geo')
client.close()

.. method:: index_cdt_create(ns: str, set: str, bin: str, index_type, index_datatype, index_name: str, ctx: list[, policy: dict])
.. method:: index_cdt_create(ns: str, set: str, bin: str, index_type, index_datatype, index_name: str, ctx: list[, policy: dict])

.. deprecated:: 20.0.0 Use the other non-deprecated index methods to create an index with a list of contexts.
.. deprecated:: 19.1.0 Use the other non-deprecated index methods to create an index with a list of contexts.

Create an collection data type (CDT) index named *index_name* for a scalar, list values, map keys, or map values (as defined by *index_type*) and for
numeric, string, or GeoJSON values (as defined by *index_datatype*)
on records of the specified *ns*, *set* whose bin is a list or map.
Create an collection data type (CDT) index named *index_name* for a scalar, list values, map keys, or map values (as defined by *index_type*) and for
numeric, string, or GeoJSON values (as defined by *index_datatype*)
on records of the specified *ns*, *set* whose bin is a list or map.

:param str ns: the namespace in the aerospike cluster.
:param str set: the set name.
:param str bin: the name of bin the secondary index is built on.
:param index_type: whether we are querying a single scalar value or specific values of a CDT type. See :ref:`aerospike_index_types`.
:param index_datatype: the type of value being queried on. See :ref:`aerospike_index_datatypes`.
:param str index_name: the name of the index.
:param dict ctx: a :class:`list` of contexts produced by :mod:`aerospike_helpers.cdt_ctx` methods.
:param dict policy: optional :ref:`aerospike_info_policies`.
:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
:param str ns: the namespace in the aerospike cluster.
:param str set: the set name.
:param str bin: the name of bin the secondary index is built on.
:param index_type: whether we are querying a single scalar value or specific values of a CDT type. See :ref:`aerospike_index_types`.
:param index_datatype: the type of value being queried on. See :ref:`aerospike_index_datatypes`.
:param str index_name: the name of the index.
:param dict ctx: a :class:`list` of contexts produced by :mod:`aerospike_helpers.cdt_ctx` methods.
:param dict policy: optional :ref:`aerospike_info_policies`.
:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.

.. index::
single: Admin Operations
Expand Down
3 changes: 3 additions & 0 deletions doc/deprecate_meta_ttl.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.. versionchanged:: 19.1.0

Deprecated the ``meta["ttl"]`` parameter. Use the policy parameter to set ``ttl`` instead.
3 changes: 3 additions & 0 deletions src/include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

#define CLUSTER_NPARTITIONS (4096)

// This allows people to see the function calling the Python client API that issues a warning
#define STACK_LEVEL 2

/*******************************************************************************
* Macros for UDF operations.
******************************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,9 @@ DEFINE_SET_OF_VALID_KEYS(client_config_policies, "read", "write", "apply",
"batch_parent_write", "info", "admin", "txn_verify",
"txn_roll", "total_timeout", "auth_mode",
"login_timeout_ms", "key", "exists", "max_retries",
"replica", "commit_level", "metrics", NULL)
"replica", "commit_level", "metrics", "read_mode_ap",
"max_threads", "thread_pool_size", "socket_timeout",
NULL)

DEFINE_SET_OF_VALID_KEYS(client_config_tls, "enable", "cafile", "capath",
"protocols", "cipher_suite", "keyfile", "keyfile_pw",
Expand Down
11 changes: 11 additions & 0 deletions src/main/client/remove.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ PyObject *AerospikeClient_Remove(AerospikeClient *self, PyObject *args,
return NULL;
}

if (py_meta) {
int retval = PyErr_WarnEx(
PyExc_DeprecationWarning,
"meta parameter is deprecated and will be removed in the "
"next client major release",
STACK_LEVEL);
if (retval == -1) {
return NULL;
}
}

// Invoke Operation
return AerospikeClient_Remove_Invoke(self, py_key, py_meta, py_policy);
}
15 changes: 8 additions & 7 deletions src/main/client/sec_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ PyObject *AerospikeClient_Index_Expr_Create(AerospikeClient *self,
NULL, py_expr);
}

// This allows people to see the function calling the Python client API that issues a warning
#define STACK_LEVEL 2

// TODO: way to get method name dynamically for error message?
static inline PyObject *
AerospikeClient_Index_Create_Helper(AerospikeClient *self, PyObject *args,
Expand Down Expand Up @@ -469,10 +466,14 @@ PyObject *AerospikeClient_Index_2dsphere_Create(AerospikeClient *self,
PyObject *AerospikeClient_Index_Cdt_Create(AerospikeClient *self,
PyObject *args, PyObject *kwds)
{
PyErr_WarnEx(PyExc_DeprecationWarning,
"index_cdt_create() is deprecated. Please use one of the "
"other non-deprecated index_*_create() methods instead",
STACK_LEVEL);
int retval =
PyErr_WarnEx(PyExc_DeprecationWarning,
"index_cdt_create() is deprecated. Please use one of the "
"other non-deprecated index_*_create() methods instead",
STACK_LEVEL);
if (retval == -1) {
return NULL;
}

// Initialize error
as_error err;
Expand Down
14 changes: 14 additions & 0 deletions src/main/conversions.c
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,10 @@ void initialize_bin_for_strictypes(AerospikeClient *self, as_error *err,
strcpy(binop_bin->name, bin);
}

#define META_TTL_DEPRECATION_MESSAGE \
"meta[\"ttl\"] is deprecated and will be removed in " \
"the next client major release."

/**
*******************************************************************************************************
* This function checks for metadata and if present set it into the
Expand Down Expand Up @@ -2327,6 +2331,16 @@ as_status check_and_set_meta(PyObject *py_meta, uint32_t *ttl_ref,
uint32_t ttl = 0;
uint16_t gen = 0;
if (py_ttl) {
int retval =
PyErr_WarnEx(PyExc_DeprecationWarning,
META_TTL_DEPRECATION_MESSAGE, STACK_LEVEL);
if (retval == -1) {
// This handles the codepath where warnings are converted into errors from pytest/python cli
// TODO: this does NOT handle the codepath where the warning mechanism itself fails
return as_error_update(err, AEROSPIKE_ERR,
META_TTL_DEPRECATION_MESSAGE);
}

if (PyLong_Check(py_ttl)) {
ttl = (uint32_t)PyLong_AsLong(py_ttl);
}
Expand Down
15 changes: 10 additions & 5 deletions test/new_tests/test_append.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ def test_pos_append_with_policy_key_gen_EQ_ignore(self):
key = ("test", "demo", 1)
policy = {
"gen": aerospike.POLICY_GEN_IGNORE,
"ttl": 1200
}

meta = {"gen": 10, "ttl": 1200}
meta = {"gen": 10}
self.as_connection.append(key, "name", "str", meta, policy)

(key, meta, bins) = self.as_connection.get(key)
Expand All @@ -135,12 +136,13 @@ def test_pos_append_with_policy_key_gen_EQ_positive(self):
key = ("test", "demo", 1)
policy = {
"gen": aerospike.POLICY_GEN_EQ,
"ttl": 1200
}
(key, meta) = self.as_connection.exists(key)

gen = meta["gen"]

meta = {"gen": gen, "ttl": 1200}
meta = {"gen": gen}
self.as_connection.append(key, "name", "str", meta, policy)

(key, meta, bins) = self.as_connection.get(key)
Expand All @@ -160,11 +162,12 @@ def test_pos_append_with_policy_key_gen_GT_positive(self):
key = ("test", "demo", 1)
policy = {
"gen": aerospike.POLICY_GEN_GT,
"ttl": 1200
}
(key, meta) = self.as_connection.exists(key)
gen = meta["gen"]

meta = {"gen": gen + 2, "ttl": 1200}
meta = {"gen": gen + 2}
self.as_connection.append(key, "name", "str", meta, policy)

(key, meta, bins) = self.as_connection.get(key)
Expand Down Expand Up @@ -294,12 +297,13 @@ def test_neg_append_with_policy_key_gen_GT_lesser(self):
key = ("test", "demo", 1)
policy = {
"gen": aerospike.POLICY_GEN_GT,
"ttl": 1200
}
(key, meta) = self.as_connection.exists(key)

gen = meta["gen"]

meta = {"gen": gen, "ttl": 1200}
meta = {"gen": gen}
try:
self.as_connection.append(key, "name", "str", meta, policy)
except e.RecordGenerationError as exception:
Expand All @@ -321,11 +325,12 @@ def test_neg_append_with_policy_key_gen_EQ_not_equal(self):
key = ("test", "demo", 1)
policy = {
"gen": aerospike.POLICY_GEN_EQ,
"ttl": 1200
}
(key, meta) = self.as_connection.exists(key)
gen = meta["gen"]

meta = {"gen": gen + 5, "ttl": 1200}
meta = {"gen": gen + 5}
try:
self.as_connection.append(key, "name", "str", meta, policy)

Expand Down
Loading