fix(ui): strengthen scrub assertion, cover degraded vdev render path
Addresses code review: differentiate pool_scrub_line/1 FINISHED clause with the word "finished", test the degraded-vdev callout via a second DEGRADED pool in the fixture, and replace the generic "scrub" match with an assertion on the full finished line.
This commit is contained in:
parent
f05c20ed0b
commit
dd992573a1
2 changed files with 29 additions and 2 deletions
|
|
@ -185,7 +185,7 @@ defmodule ServerWeb.HostDetailLive do
|
|||
|
||||
defp pool_scrub_line(%{"scan_state" => "FINISHED", "last_scrub_end" => end_time})
|
||||
when is_binary(end_time) and end_time != "",
|
||||
do: "scrub #{end_time}"
|
||||
do: "scrub finished #{end_time}"
|
||||
|
||||
defp pool_scrub_line(%{"last_scrub_end" => end_time}) when is_binary(end_time) and end_time != "",
|
||||
do: "scrub #{end_time}"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,26 @@ defmodule ServerWeb.HostDetailLiveTest do
|
|||
%{"name" => "mirror-0", "type" => "mirror", "state" => "ONLINE",
|
||||
"read_errors" => 0, "write_errors" => 0, "checksum_errors" => 0}
|
||||
]
|
||||
},
|
||||
%{
|
||||
"name" => "tank",
|
||||
"health" => "DEGRADED",
|
||||
"pool_type" => "raidz2",
|
||||
"size_bytes" => 8_000_000_000_000,
|
||||
"allocated_bytes" => 6_000_000_000_000,
|
||||
"free_bytes" => 2_000_000_000_000,
|
||||
"capacity_percent" => 75,
|
||||
"fragmentation_percent" => 55,
|
||||
"error_count" => 2,
|
||||
"vdev_count" => 1,
|
||||
"degraded_vdev_count" => 1,
|
||||
"scan_function" => "scrub",
|
||||
"scan_state" => "SCANNING",
|
||||
"last_scrub_end" => nil,
|
||||
"vdevs" => [
|
||||
%{"name" => "raidz2-0", "type" => "raidz2", "state" => "DEGRADED",
|
||||
"read_errors" => 0, "write_errors" => 0, "checksum_errors" => 2}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -93,7 +113,14 @@ defmodule ServerWeb.HostDetailLiveTest do
|
|||
assert html =~ "186.3 GB" # allocated_bytes formatted
|
||||
assert html =~ "279.4 GB" # free_bytes formatted
|
||||
assert html =~ "capbar"
|
||||
assert html =~ "scrub"
|
||||
assert html =~ "scrub finished Sat Apr 19 02:00:00 2026"
|
||||
assert html =~ "tank"
|
||||
assert html =~ "DEGRADED"
|
||||
assert html =~ "raidz2"
|
||||
assert html =~ "scrub scanning"
|
||||
assert html =~ "raidz2-0 DEGRADED"
|
||||
assert html =~ "cksum=2"
|
||||
assert html =~ "callout err"
|
||||
end
|
||||
|
||||
test "404 for unknown host", %{conn: conn} do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue