Skip to content

Commit

Permalink
fix: error when expected CRD is not deployed instead of skip (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
Elsie4ever authored Jun 20, 2024
1 parent e2ee6d8 commit b4615bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
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 @@ -31,8 +31,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

0 comments on commit b4615bf

Please sign in to comment.