Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 9 additions & 0 deletions .ddev/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,15 @@ unsorted = [
'otel',
]

# Use this to validate the name of the integration that must appear in each row of the metadata.csv file
# This integrations for historical reasons do not have a name in metadata that aligns with their
# display name.
[overrides.validate.metadata.integration]
ecs_fargate = "amazon_fargate"
kube_scheduler = "kube_scheduler"
nginx_ingress_controller = "nginx_ingress_controller"


[overrides.dep.updates]
exclude = [
'pyasn1', # https://github.com/pyasn1/pyasn1/issues/52
Expand Down
1 change: 1 addition & 0 deletions ddev/changelog.d/21836.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a way for historical snowflakes to overide their integration name used in the metadata file validation
2 changes: 1 addition & 1 deletion ddev/src/ddev/cli/validate/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def metadata(app: Application, integrations: tuple[str, ...], check_duplicates:

# integration header
integration = row['integration']
normalized_integration = current_check.normalized_display_name
normalized_integration = current_check.metadata_integration_name
if integration != normalized_integration and normalized_integration not in excluded:
errors = True

Expand Down
7 changes: 7 additions & 0 deletions ddev/src/ddev/integration/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ def normalized_display_name(self) -> str:
normalized_integration = normalized_integration.strip("_")
return normalized_integration.lower()

@cached_property
def metadata_integration_name(self) -> str:
if name := cast(str, self.repo_config.get(f'/overrides/validate/metadata/integration/{self.name}', None)):
return name

return self.normalized_display_name

@cached_property
def project_file(self) -> Path:
return self.path / 'pyproject.toml'
Expand Down
35 changes: 35 additions & 0 deletions ddev/tests/cli/validate/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,41 @@ def test_integration_header(ddev, repository, helpers):
)


def test_integration_header_with_override(ddev, repository, helpers):
helpers.write_file(
repository.path / 'apache',
'metadata.csv',
helpers.dedent(
"""
metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation,integration,short_name,curated_metric
apache.conns_total,gauge,,connection,,The number of connections.,0,apache___,,
"""
),
)

helpers.write_file(
repository.path / ".ddev",
"config.toml",
helpers.dedent(
"""
[overrides.validate.metadata.integration]
apache = "apache___"
"""
),
)

result = ddev("validate", "metadata", 'apache')

assert result.exit_code == 0, result.output
assert helpers.remove_trailing_spaces(result.output) == helpers.dedent(
"""
Metrics validation

Passed: 1
"""
)


def test_invalid_orientation(ddev, repository, helpers):
metrics_file = repository.path / 'apache' / 'metadata.csv'
outfile = os.path.join('apache', 'metadata.csv')
Expand Down
Loading