health: do Warnable dependency filtering in tailscaled
Previously we were depending on the GUI(s) to do it. By doing it in tailscaled, GUIs can be simplified and be guaranteed to render consistent results. If warnable A depends on warnable B, if both A & B are unhealhy, only B will be shown to the GUI as unhealthy. Once B clears up, only then will A be presented as unhealthy. Updates #14687 Change-Id: Id8566f2672d8d2d699740fa053d4e2a2c8009e83 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
76dc028b38
commit
bfde8079a0
@@ -257,9 +257,15 @@ func TestCheckDependsOnAppearsInUnhealthyState(t *testing.T) {
|
||||
}
|
||||
ht.SetUnhealthy(w2, Args{ArgError: "w2 is also unhealthy now"})
|
||||
us2, ok := ht.CurrentState().Warnings[w2.Code]
|
||||
if !ok {
|
||||
t.Fatalf("Expected an UnhealthyState for w2, got nothing")
|
||||
if ok {
|
||||
t.Fatalf("Saw w2 being unhealthy but it shouldn't be, as it depends on unhealthy w1")
|
||||
}
|
||||
ht.SetHealthy(w1)
|
||||
us2, ok = ht.CurrentState().Warnings[w2.Code]
|
||||
if !ok {
|
||||
t.Fatalf("w2 wasn't unhealthy; want it to be unhealthy now that w1 is back healthy")
|
||||
}
|
||||
|
||||
wantDependsOn = slices.Concat([]WarnableCode{w1.Code}, wantDependsOn)
|
||||
if !reflect.DeepEqual(us2.DependsOn, wantDependsOn) {
|
||||
t.Fatalf("Expected DependsOn = %v in the unhealthy state, got: %v", wantDependsOn, us2.DependsOn)
|
||||
|
||||
Reference in New Issue
Block a user