diff --git a/server/server.go b/server/server.go index 094d3d8078..2649028af8 100644 --- a/server/server.go +++ b/server/server.go @@ -1008,7 +1008,7 @@ func (s *Server) unversionedGetHealth(w http.ResponseWriter, r *http.Request) { // Ensure that all plugins (if requested to be included in the result) have an OK status. hasErr := false for _, status := range pluginStatuses { - if status.State != plugins.StateOK { + if status != nil && status.State != plugins.StateOK { hasErr = true break } diff --git a/server/server_test.go b/server/server_test.go index e9e274f3b4..0522114393 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -326,7 +326,6 @@ func TestUnversionedGetHealthCheckDiscoveryWithPlugins(t *testing.T) { }, exp: 500, }, - { note: "all plugins ready - recovery", statusUpdates: map[string]*plugins.Status{ @@ -336,6 +335,13 @@ func TestUnversionedGetHealthCheckDiscoveryWithPlugins(t *testing.T) { }, exp: 200, }, + { + note: "nil plugin status", + statusUpdates: map[string]*plugins.Status{ + "p1": nil, + }, + exp: 200, + }, } for _, tc := range cases {