Skip to content

Commit

Permalink
Float fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden3c committed Sep 17, 2024
1 parent 48f8597 commit 0412117
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/api/v25_04_0/smartctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AtaSelfTest(BaseModel):
description: str
status: str
status_verbose: str
remaining: int
remaining: float
lifetime: int
lba_of_first_error: int | None = None

Expand Down
2 changes: 1 addition & 1 deletion src/middlewared/middlewared/plugins/smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def parse_smart_selftest_results(data) -> list[AtaSelfTest] | list[NvmeSelfTest]

# remaining_percent is in the dict only if the test is in progress (status value & 0x0f)
if remaining := entry["status"]["value"] & 0x0f:
remaining = entry["status"]["remaining_percent"]
remaining = entry["status"]["remaining_percent"] / 100

test = AtaSelfTest(
num=index,
Expand Down
4 changes: 2 additions & 2 deletions src/middlewared/middlewared/pytest/unit/plugins/test_smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test__parse_smart_selftest_results__ataprint__1():
description="Short offline",
status="SUCCESS",
status_verbose="Completed without error",
remaining=0,
remaining=0.0,
lifetime=16590,
lba_of_first_error=None
),
Expand Down Expand Up @@ -98,7 +98,7 @@ def test__parse_smart_selftest_results__ataprint__2():
description="Offline",
status="RUNNING",
status_verbose="Self-test routine in progress",
remaining=100,
remaining=1.0,
lifetime=0,
lba_of_first_error=None
)
Expand Down

0 comments on commit 0412117

Please sign in to comment.