diff --git a/.ddev/config.toml b/.ddev/config.toml index 84b230780e405..fcf1ae4523154 100644 --- a/.ddev/config.toml +++ b/.ddev/config.toml @@ -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 diff --git a/ddev/changelog.d/21836.fixed b/ddev/changelog.d/21836.fixed new file mode 100644 index 0000000000000..3aeb7f1010b50 --- /dev/null +++ b/ddev/changelog.d/21836.fixed @@ -0,0 +1 @@ +Add a way for historical snowflakes to overide their integration name used in the metadata file validation \ No newline at end of file diff --git a/ddev/src/ddev/cli/validate/metadata.py b/ddev/src/ddev/cli/validate/metadata.py index 7e31924fc904b..b2d3ea836e9ad 100644 --- a/ddev/src/ddev/cli/validate/metadata.py +++ b/ddev/src/ddev/cli/validate/metadata.py @@ -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 diff --git a/ddev/src/ddev/integration/core.py b/ddev/src/ddev/integration/core.py index deac00bb18fab..5e5b782765b53 100644 --- a/ddev/src/ddev/integration/core.py +++ b/ddev/src/ddev/integration/core.py @@ -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' diff --git a/ddev/tests/cli/validate/test_metrics.py b/ddev/tests/cli/validate/test_metrics.py index 1062b982b7b22..f3c8ff88afe42 100644 --- a/ddev/tests/cli/validate/test_metrics.py +++ b/ddev/tests/cli/validate/test_metrics.py @@ -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')