Skip to content

TestSimple::test_directory_ttl_update fails on etcd 3.5 #293

@winterheart

Description

@winterheart

With etcd 3.5 TestSimple::test_directory_ttl_update fails with error:

pytest -k test_directory_ttl_update 
============================= test session starts ==============================
platform linux -- Python 3.12.9, pytest-8.3.4, pluggy-1.5.0
rootdir: /home/winterheart/playground/python-etcd
plugins: pkgcore-0.12.29
collected 148 items / 147 deselected / 1 selected                              

src/etcd/tests/integration/test_simple.py F                              [100%]

=================================== FAILURES ===================================
_____________________ TestSimple.test_directory_ttl_update _____________________

self = <etcd.tests.integration.test_simple.TestSimple testMethod=test_directory_ttl_update>

    def test_directory_ttl_update(self):
        """INTEGRATION: should be able to update a dir TTL"""
        self.client.write("/dir", None, dir=True, ttl=30)
>       res = self.client.write("/dir", None, dir=True, ttl=31, prevExist=True)

src/etcd/tests/integration/test_simple.py:129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/etcd/client.py:528: in write
    response = self.api_execute(path, method, params=params)
src/etcd/client.py:927: in wrapper
    return self._handle_server_response(response)
src/etcd/client.py:1011: in _handle_server_response
    etcd.EtcdError.handle(r)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'etcd.EtcdError'>
payload = {'cause': 'nodePath /1/dir : Not a file ()', 'errorCode': 300, 'index': 0, 'message': 'Raft Internal Error', ...}

    @classmethod
    def handle(cls, payload):
        """
        Decodes the error and throws the appropriate error message
    
        :param payload: The decoded JSON error payload as a dict.
        """
        error_code = payload.get("errorCode")
        message = payload.get("message")
        cause = payload.get("cause")
        msg = "{} : {}".format(message, cause)
        status = payload.get("status")
        # Some general status handling, as
        # not all endpoints return coherent error messages
        if status == 404:
            error_code = 100
        elif status == 401:
            error_code = 110
        exc = cls.error_exceptions.get(error_code, EtcdException)
        if issubclass(exc, EtcdException):
>           raise exc(msg, payload)
E           etcd.EtcdException: Raft Internal Error : nodePath /1/dir : Not a file ()

src/etcd/__init__.py:322: EtcdException
---------------------------- Captured stderr setup -----------------------------
...
=============================== warnings summary ===============================
src/etcd/tests/integration/test_simple.py::TestSimple::test_directory_ttl_update
src/etcd/tests/integration/test_simple.py::TestSimple::test_directory_ttl_update
  /home/winterheart/playground/python-etcd/src/etcd/client.py:978: DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default).
    cluster_id = response.getheader("x-etcd-cluster-id")

src/etcd/tests/integration/test_simple.py::TestSimple::test_directory_ttl_update
  /home/winterheart/playground/python-etcd/src/etcd/__init__.py:64: DeprecationWarning: HTTPResponse.getheaders() is deprecated and will be removed in urllib3 v2.1.0. Instead access HTTPResponse.headers directly.
    headers = response.getheaders()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED src/etcd/tests/integration/test_simple.py::TestSimple::test_directory_ttl_update - etcd.EtcdException: Raft Internal Error : nodePath /1/dir : Not a file ()
================ 1 failed, 147 deselected, 3 warnings in 12.30s ================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions