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 fail if we have opensearch snap installed in our local machine #519

Open
phvalguima opened this issue Dec 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@phvalguima
Copy link
Contributor

The TLS unit tests will fail with "permission denied" if we have the opensearch snap installed in our machine.

One example of trace:

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-4196-improve-plugin-manager/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-4196-improve-plugin-manager/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-4196-improve-plugin-manager/opensearch-operator/tests/unit/lib/test_opensearch_tls.py", line 1638, in test_on_certificate_available_rotation_ongoing_on_this_unit
    self.charm.tls._on_certificate_available(self.charm.on.certificate_available)
  File "/home/pguimaraes/Documents/Canonical/Engineering/DPE-4196-improve-plugin-manager/opensearch-operator/lib/charms/opensearch/v0/opensearch_tls.py", line 240, in _on_certificate_available
    if not self.store_new_ca(self.charm.secrets.get_object(scope, cert_type.val)):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pguimaraes/Documents/Canonical/Engineering/DPE-4196-improve-plugin-manager/opensearch-operator/lib/charms/opensearch/v0/opensearch_tls.py", line 574, in store_new_ca
    self._add_ca_to_request_bundle(secrets.get("chain"))
  File "/home/pguimaraes/Documents/Canonical/Engineering/DPE-4196-improve-plugin-manager/opensearch-operator/lib/charms/opensearch/v0/opensearch_tls.py", line 964, in _add_ca_to_request_bundle
    if not bundle_path.exists():
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 862, in exists
    self.stat(follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.12/pathlib.py", line 842, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/snap/opensearch/current/etc/opensearch/certificates/chain.pem'
@phvalguima phvalguima added the bug Something isn't working label Dec 7, 2024
Copy link

Thank you for reporting us your feedback!

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

This message was autogenerated

Copy link

Thank you for reporting us your feedback!

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

This message was autogenerated

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

No branches or pull requests

1 participant