Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nginx_k8s/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased

- Updated project URLs.
- Close the config file that `_has_config_changed` pulls from the container, instead of leaving it to the garbage collector.

# 1.0.1 - 22 June 2026

Expand Down
7 changes: 5 additions & 2 deletions nginx_k8s/src/charmlibs/nginx_k8s/_nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@ def _has_config_changed(self, new_config: str) -> bool:
return False

try:
with _tracer.start_as_current_span('read config'):
current_config = self._container.pull(self.NGINX_CONFIG).read()
with (
_tracer.start_as_current_span('read config'),
self._container.pull(self.NGINX_CONFIG) as config_file,
):
current_config = config_file.read()
except pebble.PathError:
logger.debug('nginx configuration file not found at %s', str(self.NGINX_CONFIG))
# file does not exist! it's probably because it's the first time we're generating it.
Expand Down
21 changes: 21 additions & 0 deletions nginx_k8s/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

"""Pytest configuration and fixtures that apply to all this package's tests."""

import pytest


def pytest_configure(config: pytest.Config) -> None:
"""Pytest configuration specific to the nginx_k8s package.

Used instead of the package's ``pyproject.toml`` or ``pytest.ini`` so that the repository
root's ``pyproject.toml`` is treated as the pytest root. Otherwise pytest would use the
package's file as its only config, silently dropping the root's ``--strict-markers`` and
shared marker list.
"""
# Opt in to warnings-as-errors.
# Relax a category for a single test with the @pytest.mark.filterwarnings decorator:
# https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-filterwarnings-ref
# https://docs.python.org/3/library/warnings.html#warning-filter
config.addinivalue_line('filterwarnings', 'error')
15 changes: 8 additions & 7 deletions nginx_k8s/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions rollingops/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2026 Canonical Ltd.
# See LICENSE file for licensing details.

"""Pytest configuration and fixtures that apply to all this package's tests."""

import pytest


def pytest_configure(config: pytest.Config) -> None:
"""Pytest configuration specific to the rollingops package.

Used instead of the package's ``pyproject.toml`` or ``pytest.ini`` so that the repository
root's ``pyproject.toml`` is treated as the pytest root. Otherwise pytest would use the
package's file as its only config, silently dropping the root's ``--strict-markers`` and
shared marker list.
"""
# Opt in to warnings-as-errors.
# Relax a category for a single test with the @pytest.mark.filterwarnings decorator:
# https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-filterwarnings-ref
# https://docs.python.org/3/library/warnings.html#warning-filter
config.addinivalue_line('filterwarnings', 'error')
18 changes: 12 additions & 6 deletions rollingops/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading