Skip to content

Commit

Permalink
[CLIENT-2267] Revert adding base64 methods to aerospike module (#409)
Browse files Browse the repository at this point in the history
* Address fast forward PR workflow not working
  • Loading branch information
juliannguyen4 authored Mar 29, 2023
1 parent 9272ceb commit 0889d04
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 133 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ff-master-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# Basic use case example
- name: Fast Forward PR
id: ff-action
uses: ./
uses: endre-spotlab/fast-forward-js-action@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
success_message: 'Success! Fast forwarded master to stage! ```git checkout master && git merge stage --ff-only``` '
Expand Down
27 changes: 0 additions & 27 deletions doc/aerospike.rst
Original file line number Diff line number Diff line change
Expand Up @@ -308,33 +308,6 @@ Logging
:param int log_level: one of the :ref:`aerospike_log_levels` constant values.
Base64
------
.. method:: get_cdtctx_base64(ctx: list) -> str
Get the base64 representation of aerospike CDT ctx.
See :ref:`aerospike_operation_helpers.cdt_ctx` for more details on CDT context.
:param list ctx: Aerospike CDT context: generated by aerospike CDT ctx helper :mod:`aerospike_helpers`.
:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
.. include:: examples/get_cdtctx_base64.py
:code: python
.. method:: get_expression_base64(expression) -> str
Get the base64 representation of a compiled aerospike expression.
See :ref:`aerospike_operation_helpers.expressions` for more details on expressions.
:param AerospikeExpression expression: the compiled expression.
:raises: a subclass of :exc:`~aerospike.exception.AerospikeError`.
.. include:: examples/get_expression_base64.py
:code: python
Other
-----
Expand Down
6 changes: 2 additions & 4 deletions doc/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,7 @@ Info Operations
.. include:: examples/get_expression_base64.py
:code: python

.. deprecated:: 11.0.0
:meth:`aerospike.get_expression_base64` should be used instead.
.. versionchanged:: 7.0.0

.. method:: shm_key() -> int

Expand Down Expand Up @@ -1070,8 +1069,7 @@ Index Operations
.. include:: examples/get_cdtctx_base64.py
:code: python

.. deprecated:: 11.0.0
:meth:`aerospike.get_cdtctx_base64` should be used instead.
.. versionchanged:: 7.1.1


.. index::
Expand Down
19 changes: 0 additions & 19 deletions src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ PyDoc_STRVAR(init_async_doc,
"init_async() -> initialize aerospike async eventloop library\n\
aerospike.init_async()");

PyDoc_STRVAR(get_expression_base64_doc,
"get_expression_base64(compiled_expression: list) -> str\n\
\n\
Get the base64 representation of a compiled aerospike expression.");

PyDoc_STRVAR(get_cdtctx_base64_doc,
"get_cdtctx_base64(compiled_cdtctx: list) -> str\n\
\n\
Get the base64 representation of a compiled aerospike CDT ctx.");

static PyMethodDef Aerospike_Methods[] = {

//Serialization
Expand Down Expand Up @@ -102,15 +92,6 @@ static PyMethodDef Aerospike_Methods[] = {
{"is_async_supoorted", (PyCFunction)Aerospike_Is_AsyncSupported,
METH_NOARGS, "check whether async supported or not"},

// Base64 methods (copied from client)
// The client base64 methods are now deprecated

{"get_expression_base64", (PyCFunction)AerospikeClient_GetExpressionBase64,
METH_VARARGS | METH_KEYWORDS, get_expression_base64_doc},

{"get_cdtctx_base64", (PyCFunction)AerospikeClient_GetCDTCTXBase64,
METH_VARARGS | METH_KEYWORDS, get_cdtctx_base64_doc},

{NULL}};

static AerospikeConstants operator_constants[] = {
Expand Down
21 changes: 0 additions & 21 deletions test/new_tests/base64_helpers.py

This file was deleted.

18 changes: 2 additions & 16 deletions test/new_tests/test_cdt_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from aerospike import exception as e
from .index_helpers import ensure_dropped_index
from aerospike_helpers import cdt_ctx
from . import base64_helpers

list_index = "list_index"
list_rank = "list_rank"
Expand Down Expand Up @@ -113,26 +112,13 @@ def test_pos_cdtindex_with_correct_parameters(self):

assert retobj == 0

# Backwards compatibility test
@pytest.mark.parametrize(
"get_cdtctx_base64_parent",
[
# We don't pass the client method directly
# since it requires a client instance from the test class using "self"
# So access the client later through the test method
("client"),
("aerospike"),
]
)
def test_pos_cdtindex_with_info_command(self, get_cdtctx_base64_parent):
def test_pos_cdtindex_with_info_command(self):
"""
Invoke index_cdt_create() with info command
"""
get_cdtctx_base64 = base64_helpers.get_cdtctx_base64_method(self, get_cdtctx_base64_parent)

policy = {}

bs_b4_cdt = get_cdtctx_base64(ctx_list_index)
bs_b4_cdt = self.as_connection.get_cdtctx_base64(ctx_list_index)

r = []
r.append("sindex-create:ns=test;set=demo;indexname=test_string_list_cdt_index")
Expand Down
22 changes: 7 additions & 15 deletions test/new_tests/test_get_cdtctx_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from aerospike import exception as e
from .index_helpers import ensure_dropped_index
from aerospike_helpers import cdt_ctx
from . import base64_helpers

list_index = "list_index"
list_rank = "list_rank"
Expand Down Expand Up @@ -57,15 +56,8 @@ def add_ctx_op(ctx_type, value):


class TestCDTIndexB64(object):
# Backwards compatibility test
# Setup client connection before deciding which method to use
# Order of fixtures executed: as_connection() -> get_cdtctx_base64_method() -> setup()
@pytest.fixture(scope="class", params=["client", "aerospike"])
def get_cdtctx_base64_method(self, request, as_connection):
return base64_helpers.get_cdtctx_base64_method(self, request.param)

@pytest.fixture(autouse=True)
def setup(self, request, get_cdtctx_base64_method, as_connection):
def setup(self, request, as_connection):
if TestBaseClass.major_ver < 6 or (TestBaseClass.major_ver == 6 and TestBaseClass.minor_ver == 0):
pytest.skip("It only applies to >= 6.1 enterprise edition")

Expand Down Expand Up @@ -101,12 +93,12 @@ def teardown():

request.addfinalizer(teardown)

def test_get_cdtctxb64_with_correct_parameters(self, get_cdtctx_base64_method):
def test_get_cdtctxb64_with_correct_parameters(self):
"""
Invoke get_cdtctx_base64() with correct arguments
"""
policy = {}
bs_b4_cdt = get_cdtctx_base64_method([cdt_ctx.cdt_ctx_list_index(0)])
bs_b4_cdt = self.as_connection.get_cdtctx_base64([cdt_ctx.cdt_ctx_list_index(0)])

r = []
r.append("sindex-create:ns=test;set=demo;indexname=test_string_list_cdt_index")
Expand All @@ -124,20 +116,20 @@ def test_get_cdtctxb64_with_correct_parameters(self, get_cdtctx_base64_method):

assert retobj != 0

def test_get_cdtctxb64_with_invalid_parameters(self, get_cdtctx_base64_method):
def test_get_cdtctxb64_with_invalid_parameters(self):
"""
Invoke get_cdtctx_base64() with invalid arguments
"""
try:
get_cdtctx_base64_method({})
self.as_connection.get_cdtctx_base64({})
except e.ParamError:
pass

def test_get_cdtctxb64_with_invalid_ctx(self, get_cdtctx_base64_method):
def test_get_cdtctxb64_with_invalid_ctx(self):
"""
Invoke get_cdtctx_base64() with invalid arguments
"""
try:
get_cdtctx_base64_method(ctx_empty)
self.as_connection.get_cdtctx_base64(ctx_empty)
except e.ParamError:
pass
27 changes: 12 additions & 15 deletions test/new_tests/test_get_expression_base64r.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,21 @@
)

import aerospike
from . import base64_helpers


@pytest.mark.xfail(TestBaseClass.temporary_xfail(), reason="xfail variable set")
@pytest.mark.usefixtures("as_connection", "connection_config")
class TestGetExpressionBase64(object):
# Backwards compatibility test
# Setup client connection before deciding which method to use
@pytest.fixture(scope="class", params=["client", "aerospike"])
def get_expression_base64_method(self, request, as_connection, connection_config):
return base64_helpers.get_expression_base64_method(self, request.param)

def test_get_expression_base64_pos(self, get_expression_base64_method):
@pytest.fixture(autouse=True)
def setup_method(self, request, as_connection):
pass

def test_get_expression_base64_pos(self):
expr = Eq(IntBin("bin1"), 6).compile()
b64 = get_expression_base64_method(expr)
b64 = self.as_connection.get_expression_base64(expr)
assert b64 == "kwGTUQKkYmluMQY="

def test_get_expression_base64_large_expression_pos(self, get_expression_base64_method):
def test_get_expression_base64_large_expression_pos(self):
bin = "ilist_bin"
expr = And(
Eq(
Expand Down Expand Up @@ -101,7 +98,7 @@ def test_get_expression_base64_large_expression_pos(self, get_expression_base64_
Eq(ListGetByRankRange(None, aerospike.LIST_RETURN_COUNT, 1, ListSize(None, bin), bin), 2),
).compile()

b64 = get_expression_base64_method(expr)
b64 = self.as_connection.get_expression_base64(expr)
expected = (
"lxCTAZV/AgCVGwWVfwIAkxMHAJNRBKlpbGlzdF9iaW4BA5NRBKlpbGlzdF9iaW4CkwGVfwQAkxYBBpV/BAC"
"UGQcBB5NRBKlpbGlzdF9iaW6SfpECkwGVfwIAkxcFkn6SAgaVfwQAlBsHAQGTUQSpaWxpc3RfYmluApMBlX8CAJMYBQGVfwQAlBgHAQOTU"
Expand All @@ -111,10 +108,10 @@ def test_get_expression_base64_large_expression_pos(self, get_expression_base64_

assert b64 == expected

def test_get_expression_base64_bad_filter_neg(self, get_expression_base64_method):
def test_get_expression_base64_bad_filter_neg(self):
with pytest.raises(e.ParamError):
get_expression_base64_method("bad_filter")
self.as_connection.get_expression_base64("bad_filter")

def test_get_expression_base64_bad_list_filter_neg(self, get_expression_base64_method):
def test_get_expression_base64_bad_list_filter_neg(self):
with pytest.raises(e.ParamError):
get_expression_base64_method(["hi"])
self.as_connection.get_expression_base64(["hi"])
17 changes: 2 additions & 15 deletions test/new_tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from aerospike_helpers import cdt_ctx
from threading import Lock
import time
from . import base64_helpers

list_index = "list_index"
list_rank = "list_rank"
Expand Down Expand Up @@ -1044,18 +1043,6 @@ def callback(input_tuple):
assert records
assert len(records) == 3

# Backwards compatibility test
@pytest.mark.parametrize(
"get_cdtctx_base64_parent",
[
# We don't pass the client method directly
# since it requires a client instance from the test class using "self"
# So access the client later through the test method
("client"),
("aerospike"),
]
)
def test_query_with_base64_cdt_ctx(self, get_cdtctx_base64_parent):
get_cdtctx_base64 = base64_helpers.get_cdtctx_base64_method(self, get_cdtctx_base64_parent)
bs_b4_cdt = get_cdtctx_base64(ctx_list_index)
def test_query_with_base64_cdt_ctx(self):
bs_b4_cdt = self.as_connection.get_cdtctx_base64(ctx_list_index)
assert bs_b4_cdt == "khAA"

0 comments on commit 0889d04

Please sign in to comment.