codenotary / immudb-py

immudb Python SDK
Apache License 2.0
44 stars 7 forks source link

test_sql.py failed #24

Closed gkrsman closed 3 years ago

gkrsman commented 3 years ago

tests/immu/test_sql.py failed with error below:

E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E               status = StatusCode.UNIMPLEMENTED
E               details = "unknown method SQLExec for service immudb.schema.ImmuService"
E               debug_error_string = "{"created":"@1627255447.060995531","description":"Error received from peer ipv6:[::1]:3322","file":"src/core/lib/surface/call.cc","file_line":1069,"grpc_message":"unknown method SQLExec for service immudb.schema.ImmuService","grpc_status":12}"
E           >
ufierro commented 3 years ago

Hey @gkrsman I was unable to reproduce this. Would you mind providing the steps followed prior to this error?

The way the tests are intended to be ran are the following (Just in case you're doing something different):

# Once you've entered the repository directory and created a virtual environment
$ docker run -d --health-cmd "immuadmin status" --health-interval 10s --health-timeout 5s --health-retries 5 -v $(pwd)/tests/certs/my.key.pem:/key.pem -p 3322:3322 codenotary/immudb:latest --signingKey=/key.pem

$ pip3 install -r requirements.txt && pip3 install pytest

$ make test
gkrsman commented 3 years ago

Hi @ufierro sorry for a very late reply. I had a immudb instance running in a different container when I tried tests. Today I tried to run an instance using an exact command you provided and result is the same.

Here is complete output from the terminal:

python -m pytest -vv --color=yes tests/
================================================================== test session starts ===================================================================
platform linux -- Python 3.8.7, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /home/.../.../.../bin/python
cachedir: .pytest_cache
rootdir: /home/.../.../.../immudb-py
collected 41 items                                                                                                                                       

tests/immu/test_basic.py::TestBasicGetSet::test_no_server PASSED                                                                                   [  2%]
tests/immu/test_basic.py::TestBasicGetSet::test_basic PASSED                                                                                       [  4%]
tests/immu/test_basic.py::TestBasicGetSet::test_root PASSED                                                                                        [  7%]
tests/immu/test_basic.py::TestBasicGetSet::test_property PASSED                                                                                    [  9%]
tests/immu/test_basic.py::TestBasicGetSet::test_safeSet PASSED                                                                                     [ 12%]
tests/immu/test_basic.py::TestBasicGetSet::test_get_tx PASSED                                                                                      [ 14%]
tests/immu/test_database.py::TestDatabase::test_list_use PASSED                                                                                    [ 17%]
tests/immu/test_execAll.py::TestExecAll::test_execAll_KV PASSED                                                                                    [ 19%]
tests/immu/test_execAll.py::TestExecAll::test_execAll_ref PASSED                                                                                   [ 21%]
tests/immu/test_execAll.py::TestExecAll::test_execAll_zadd PASSED                                                                                  [ 24%]
tests/immu/test_execAll.py::TestExecAll::test_execAll_unknown PASSED                                                                               [ 26%]
tests/immu/test_get_set.py::TestGetSet::test_get_set_uniq PASSED                                                                                   [ 29%]
tests/immu/test_get_set.py::TestGetSet::test_get_set_batch PASSED                                                                                  [ 31%]
tests/immu/test_get_set.py::TestGetSet::test_get_set_over PASSED                                                                                   [ 34%]
tests/immu/test_get_set.py::TestGetSet::test_set_all_get_one PASSED                                                                                [ 36%]
tests/immu/test_history.py::TestHistory::test_history PASSED                                                                                       [ 39%]
tests/immu/test_massive_operation.py::TestGetSet::test_get_set_massive PASSED                                                                      [ 41%]
tests/immu/test_offline.py::test_verify_inclusion PASSED                                                                                           [ 43%]
tests/immu/test_offline.py::test_simulated_set1 PASSED                                                                                             [ 46%]
tests/immu/test_offline.py::test_simulated_set2 PASSED                                                                                             [ 48%]
tests/immu/test_offline.py::test_printable PASSED                                                                                                  [ 51%]
tests/immu/test_offline.py::test_linearproof_fails PASSED                                                                                          [ 53%]
tests/immu/test_offline.py::test_lastinclusion_fails PASSED                                                                                        [ 56%]
tests/immu/test_offline.py::test_consistency_fails PASSED                                                                                          [ 58%]
tests/immu/test_offline.py::test_inclusionaht_fails PASSED                                                                                         [ 60%]
tests/immu/test_offline.py::test_dualproof_fails PASSED                                                                                            [ 63%]
tests/immu/test_offline.py::test_htree PASSED                                                                                                      [ 65%]
tests/immu/test_ref.py::test_reference PASSED                                                                                                      [ 68%]
tests/immu/test_scan.py::test_scan_set PASSED                                                                                                      [ 70%]
tests/immu/test_signatures.py::test_get_set PASSED                                                                                                 [ 73%]
tests/immu/test_signatures.py::test_ref PASSED                                                                                                     [ 75%]
tests/immu/test_signatures.py::test_z PASSED                                                                                                       [ 78%]
tests/immu/test_sql.py::TestSql::test_exec_query FAILED                                                                                            [ 80%]
tests/immu/test_statefile.py::test_rs PASSED                                                                                                       [ 82%]
tests/immu/test_statefile.py::test_basic PASSED                                                                                                    [ 85%]
tests/immu/test_statefile.py::test_root PASSED                                                                                                     [ 87%]
tests/immu/test_statefile.py::test_property PASSED                                                                                                 [ 90%]
tests/immu/test_statefile.py::test_safeSet PASSED                                                                                                  [ 92%]
tests/immu/test_statefile.py::test_get_tx PASSED                                                                                                   [ 95%]
tests/immu/test_user_operations.py::TestUser::test_users_functions PASSED                                                                          [ 97%]
tests/immu/test_zfunc.py::test_zfunc PASSED                                                                                                        [100%]

======================================================================== FAILURES ========================================================================
________________________________________________________________ TestSql.test_exec_query _________________________________________________________________

self = <test_sql.TestSql object at 0x7f231ddb6730>, client = <immudb.client.ImmudbClient object at 0x7f231ddb68b0>

    def test_exec_query(self, client):
>       resp = client.sqlExec(
            "create table test (id integer, name varchar, primary key id);")

tests/immu/test_sql.py:20: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
immudb/client.py:239: in sqlExec
    return sqlexec.call(self.__stub, self.__rs, stmt, params, noWait)
immudb/handler/sqlexec.py:33: in call
    result = service.SQLExec(request)
../../../.virtualenvs/immudb_py/lib/python3.8/site-packages/grpc/_interceptor.py:216: in __call__
    response, ignored_call = self._with_call(request,
../../../.virtualenvs/immudb_py/lib/python3.8/site-packages/grpc/_interceptor.py:257: in _with_call
    return call.result(), call
../../../.virtualenvs/immudb_py/lib/python3.8/site-packages/grpc/_channel.py:343: in result
    raise self
../../../.virtualenvs/immudb_py/lib/python3.8/site-packages/grpc/_interceptor.py:241: in continuation
    response, call = self._thunk(new_method).with_call(
../../../.virtualenvs/immudb_py/lib/python3.8/site-packages/grpc/_channel.py:957: in with_call
    return _end_unary_response_blocking(state, call, True, None)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

state = <grpc._channel._RPCState object at 0x7f231dda98e0>, call = <grpc._cython.cygrpc.SegregatedCall object at 0x7f231c538e00>, with_call = True
deadline = None

    def _end_unary_response_blocking(state, call, with_call, deadline):
        if state.code is grpc.StatusCode.OK:
            if with_call:
                rendezvous = _MultiThreadedRendezvous(state, call, None, deadline)
                return state.response, rendezvous
            else:
                return state.response
        else:
>           raise _InactiveRpcError(state)
E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E               status = StatusCode.UNIMPLEMENTED
E               details = "unknown method SQLExec for service immudb.schema.ImmuService"
E               debug_error_string = "{"created":"@1630524934.430318061","description":"Error received from peer ipv6:[::1]:3322","file":"src/core/lib/surface/call.cc","file_line":1069,"grpc_message":"unknown method SQLExec for service immudb.schema.ImmuService","grpc_status":12}"
E           >

../../../.virtualenvs/immudb_py/lib/python3.8/site-packages/grpc/_channel.py:849: _InactiveRpcError
================================================================ short test summary info =================================================================
FAILED tests/immu/test_sql.py::TestSql::test_exec_query - grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
============================================================== 1 failed, 40 passed in 6.45s ==============================================================
Makefile:25: recipe for target 'test' failed
make: *** [test] Error 1
ufierro commented 3 years ago

Ah well it's more clear now, can you confirm the immudb version you're running please? The error message indicates that the version might not have SQL support yet so you might want to try to

docker pull codenotary/immudb:latest

Then delete your old container and spin up a new one

ufierro commented 3 years ago

Closing issue for now, if this is not resolved using the latest immudb version please open a new one.