Extended ZFS states
This commit is contained in:
@@ -55,10 +55,24 @@ func TestFlattenZfsComponents(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestZfsStateNumeric(t *testing.T) {
|
||||
if got := zfsStateNumeric("ONLINE"); got != 1 {
|
||||
t.Fatalf("zfsStateNumeric(ONLINE) = %v, want 1", got)
|
||||
tests := []struct {
|
||||
state string
|
||||
want float64
|
||||
}{
|
||||
{state: "UNKNOWN", want: 0},
|
||||
{state: "ONLINE", want: 1},
|
||||
{state: "DEGRADED", want: 2},
|
||||
{state: "FAULTED", want: 3},
|
||||
{state: "OFFLINE", want: 4},
|
||||
{state: "REMOVED", want: 5},
|
||||
{state: "UNAVAIL", want: 6},
|
||||
}
|
||||
if got := zfsStateNumeric("DEGRADED"); got != 0 {
|
||||
t.Fatalf("zfsStateNumeric(DEGRADED) = %v, want 0", got)
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.state, func(t *testing.T) {
|
||||
if got := zfsStateNumeric(tt.state); got != tt.want {
|
||||
t.Fatalf("zfsStateNumeric(%q) = %v, want %v", tt.state, got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user