Skip to content

Commit

Permalink
Merge branch 'main' into feature/v3.7.x/jetson_uefi_rebased
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang authored Jun 26, 2024
2 parents 173bdbf + 0f9856d commit e04c7c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/otaclient_common/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pathlib import Path
from typing import Any, Callable, TypeVar, Union

from pydantic import Field
from pydantic import BeforeValidator, Field
from typing_extensions import Annotated, Concatenate, ParamSpec

P = ParamSpec("P")
Expand All @@ -31,7 +31,11 @@

# pydantic helpers

NetworkPort = Annotated[int, Field(ge=1, le=65535)]
NetworkPort = Annotated[
int,
BeforeValidator(lambda x: int(x)),
Field(ge=1, le=65535),
]


def gen_strenum_validator(
Expand Down
5 changes: 5 additions & 0 deletions tests/test_otaclient/test_configs/test_proxy_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@
"enable_ota_proxy: true\ngateway: false\n",
DEFAULT_PROXY_INFO,
),
# ------ case 7(20240626): NetworkPort allow str value ------ #
(
'local_ota_proxy_listen_port: "8082"',
ProxyInfo(local_ota_proxy_listen_port=8082),
),
),
)
def test_proxy_info(tmp_path: Path, _input_yaml: str, _expected: ProxyInfo):
Expand Down

0 comments on commit e04c7c5

Please sign in to comment.