Skip to content

Some fixes to the manifest tests involving shared components #152

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

Merged
merged 3 commits into from
Feb 7, 2025
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 newsfragments/152.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix manifest tests issues with shared components, specifically initSecrets.
8 changes: 5 additions & 3 deletions tests/manifests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import pytest

from . import component_details, values_files_to_test
from . import component_details, shared_components_details, values_files_to_test


@pytest.mark.parametrize("values_file", ["nothing-enabled-values.yaml"])
Expand All @@ -23,6 +23,8 @@ async def test_values_file_renders_only_itself(release_name, component, template
f"{release_name}-{component_details[component]['hyphened_name']}",
]
for shared_component in component_details[component].get("shared_components", []):
allowed_starts_with.append(f"{release_name}-{shared_component}")
allowed_starts_with.append(f"{release_name}-{shared_components_details[shared_component]['hyphened_name']}")
for template in templates:
assert any(template["metadata"]["name"].startswith(allowed_start) for allowed_start in allowed_starts_with)
assert any(template["metadata"]["name"].startswith(allowed_start) for allowed_start in allowed_starts_with), (
f"{[template['metadata']['name']]} does not start with one of {allowed_starts_with}"
)
2 changes: 2 additions & 0 deletions tests/manifests/test_service_monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ async def test_service_monitored_as_appropriate(component, values: dict, make_te
for shared_component in component_details[component].get("shared_components", []):
if shared_components_details[shared_component]["has_service_monitor"]:
values.setdefault(shared_component, {}).setdefault("serviceMonitors", {}).setdefault("enabled", False)
else:
values.setdefault(shared_component, {}).setdefault("labels", {}).setdefault("servicemonitor", "none")

# We should now have no ServiceMonitors rendered
workloads_to_cover = set()
Expand Down