Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLS unit tests are failing when executed with python 3.12 #468

Open
phvalguima opened this issue Oct 2, 2024 · 1 comment · May be fixed by #469
Open

TLS unit tests are failing when executed with python 3.12 #468

phvalguima opened this issue Oct 2, 2024 · 1 comment · May be fixed by #469
Assignees
Labels
bug Something isn't working

Comments

@phvalguima
Copy link
Contributor

phvalguima commented Oct 2, 2024

It seems there is a discrepancy in unit tests' behavior between python 3.10 and 3.12.

I am currently using python 3.12 and TLS tests fail with:

	
_________________________________________ TestOpenSearchTLS.test_on_certificate_available_rotation_ongoing_on_another_unit_0_main_orchestrator _________________________________________
Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/case.py", line 58, in testPartExecutor
    yield
  File "/usr/lib/python3.12/unittest/case.py", line 634, in run
    self._callTestMethod(testMethod)
  File "/usr/lib/python3.12/unittest/case.py", line 589, in _callTestMethod
    if method() is not None:
       ^^^^^^^^
  File "/home/pguimaraes/Documents/Canonical/Engineering/DPE-4115-perf-profiles/opensearch-operator/.tox/unit/lib/python3.12/site-packages/parameterized/parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/unittest/mock.py", line 1390, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pguimaraes/Documents/Canonical/Engineering/DPE-4115-perf-profiles/opensearch-operator/.tox/unit/lib/python3.12/site-packages/parameterized/parameterized.py", line 93, in dummy_func
    return orgfunc(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/unittest/mock.py", line 1390, in patched
    return func(*newargs, **newkeywargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pguimaraes/Documents/Canonical/Engineering/DPE-4115-perf-profiles/opensearch-operator/tests/unit/lib/test_opensearch_tls.py", line 1680, in test_on_certificate_available_rotation_ongoing_on_another_unit
    self.charm.on.certificate_available.defer.called_once()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/unittest/mock.py", line 663, in __getattr__
    raise AttributeError(
AttributeError: 'called_once' is not a valid assertion. Use a spec for the mock if 'called_once' is meant to be an attribute.

Once moving away from called_* to assert_called_*, and removing the assert keywords at the beginning of these lines, if any; I started to get more errors.

I have compiled some of the fixes on: https://github.com/canonical/opensearch-operator/pull/466/files#diff-76015ac74eac172fd5f5aeeaf86dc52080e1241d591163aa2f9e12732f8db2c8

But there are some yet to be added.

@phvalguima phvalguima added the bug Something isn't working label Oct 2, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-5602.

This message was autogenerated

@skourta skourta linked a pull request Oct 3, 2024 that will close this issue
@skourta skourta self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants