Skip to content
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

fix: error when expected CRD is not deployed instead of skip #244

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions azext_edge/edge/providers/check/base/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ def enumerate_ops_service_resources(
)

if not api_resources:
check_manager.add_target_eval(target_name=target_api, status=CheckTaskStatus.skipped.value)
check_manager.add_target_eval(target_name=target_api, status=CheckTaskStatus.error.value)
missing_api_text = (
f"[bright_blue]{target_api}[/bright_blue] API resources [red]not[/red] detected."
"\n\n[bright_white]Skipping deployment evaluation[/bright_white]."
)
check_manager.add_display(target_name=target_api, display=Padding(missing_api_text, (0, 0, 0, 8)))
return check_manager.as_dict(as_list), resource_kind_map
Expand Down
7 changes: 4 additions & 3 deletions azext_edge/edge/providers/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from ..common import ListableEnum, OpsServiceType
from .check.base import check_pre_deployment, display_as_list
from .check.common import ResourceOutputDetailLevel
from .check.common import COLOR_STR_FORMAT, ResourceOutputDetailLevel
from .check.dataprocessor import check_dataprocessor_deployment
from .check.deviceregistry import check_deviceregistry_deployment
from .check.lnm import check_lnm_deployment
Expand Down Expand Up @@ -48,10 +48,11 @@ def run_checks(

sleep(0.5)

color = COLOR_STR_FORMAT.format(color="bright_blue", value="{text}") if as_list else "{text}"
title_subject = (
f"{{[bright_blue]{ops_service}[/bright_blue]}} service deployment"
f"{{{color.format(text=ops_service)}}} service deployment"
if post_deployment
else "[bright_blue]IoT Operations readiness[/bright_blue]"
else color.format(text="IoT Operations readiness")
)
result["title"] = f"Evaluation for {title_subject}"

Expand Down
4 changes: 2 additions & 2 deletions azext_edge/tests/edge/checks/int/test_pre_post_int.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def test_check_pre_post(init_setup, post, pre):
result = run(command)

# default service title
expected_title = "Evaluation for {[bright_blue]mq[/bright_blue]} service deployment"
expected_precheck_title = "[bright_blue]IoT Operations readiness[/bright_blue]"
expected_title = "Evaluation for {mq} service deployment"
expected_precheck_title = "IoT Operations readiness"
expected_pre = not post if pre is None else pre
expected_post = not pre if post is None else post
assert result["title"] == expected_title if expected_post else expected_precheck_title
Expand Down