Skip to content

Commit

Permalink
http migrate: add examples
Browse files Browse the repository at this point in the history
* checks `expect_response` inside `migratable`
* adds forgotten examples to tests

CMK-21248

Change-Id: If8921545b9d274cb2eb644f4aaeee512d28cffa6
  • Loading branch information
SoloJacobs committed Jan 31, 2025
1 parent 311b29c commit b28ef2f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmk/update_config/http/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ def _migratable(rule_value: Mapping[str, object]) -> bool:
"HEAD",
):
return False
try:
_migrate_expect_response(value.mode[1].expect_response or [])
except ValueError:
return False
type_ = _classify(value.host.address[1])
if type_ is HostType.EMBEDDABLE:
# This might have some issues, since customers can put a port, uri, and really mess with
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/cmk/update_config/http/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,9 @@
EXAMPLE_57,
EXAMPLE_58,
EXAMPLE_64,
EXAMPLE_65,
EXAMPLE_66,
EXAMPLE_67,
],
)
def test_migrateable_rules(rule_value: Mapping[str, object]) -> None:
Expand Down Expand Up @@ -637,6 +640,14 @@ def test_migrate_url(rule_value: Mapping[str, object], expected: str) -> None:
page_size=None,
),
),
(
EXAMPLE_67,
Document(
document_body=DocumentBodyOption.IGNORE,
max_age=111.0,
page_size=None,
),
),
],
)
def test_migrate_document(rule_value: Mapping[str, object], expected: object) -> None:
Expand Down Expand Up @@ -804,6 +815,7 @@ def test_migrate_ssl(rule_value: Mapping[str, object], expected: str) -> None:
EXAMPLE_34,
EXAMPLE_35,
EXAMPLE_43,
EXAMPLE_44,
EXAMPLE_49,
EXAMPLE_51,
EXAMPLE_59,
Expand Down

0 comments on commit b28ef2f

Please sign in to comment.