Skip to content
Merged
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 ddev/changelog.d/23655.changed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Require a changelog entry when an integration's `conf.yaml.example` is modified, and expose the expected path through the new `Integration.example_config` property.
10 changes: 9 additions & 1 deletion ddev/src/ddev/integration/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def package_files(self) -> Iterator[Path]:
yield Path(root, f)

def requires_changelog_entry(self, path: Path) -> bool:
return self.package_directory in path.parents or (self.is_package and path == (self.path / 'pyproject.toml'))
return (
self.package_directory in path.parents
or (self.is_package and path == (self.path / 'pyproject.toml'))
or path == self.example_config
)

@property
def release_tag_pattern(self) -> str:
Expand Down Expand Up @@ -143,6 +147,10 @@ def config_spec(self) -> Path:
relative_path = self.manifest.get('/assets/integration/configuration/spec', 'assets/configuration/spec.yaml')
return self.path / relative_path

@cached_property
def example_config(self) -> Path:
return self.package_directory / 'data' / 'conf.yaml.example'

@cached_property
def minimum_base_package_version(self) -> str | None:
from packaging.requirements import Requirement
Expand Down
25 changes: 25 additions & 0 deletions ddev/tests/integration/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,28 @@ def test_has_no_metrics(self, fake_repo):
def test_has_no_metadata_file(self, fake_repo):
integration = fake_repo.integrations.get('no_metadata_file')
assert not list(integration.metrics)


def test_example_config_path(local_repo):
repo = Repository(local_repo.name, str(local_repo))
integration = repo.integrations.get('postgres')

assert integration.example_config == integration.package_directory / 'data' / 'conf.yaml.example'


@pytest.mark.parametrize(
'relative_path, expected',
[
pytest.param('datadog_checks/postgres/postgres.py', True, id='package_source_file'),
pytest.param('datadog_checks/postgres/data/conf.yaml.example', True, id='example_config'),
pytest.param('pyproject.toml', True, id='pyproject_toml'),
pytest.param('assets/configuration/spec.yaml', False, id='config_spec'),
pytest.param('README.md', False, id='readme'),
pytest.param('tests/test_postgres.py', False, id='test_file'),
],
)
def test_requires_changelog_entry(local_repo, relative_path, expected):
repo = Repository(local_repo.name, str(local_repo))
integration = repo.integrations.get('postgres')

assert integration.requires_changelog_entry(integration.path / relative_path) is expected
Loading