mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-29 07:09:33 +00:00
health,ipn/ipnlocal: introduce eventbus in heath.Tracker (#17085)
The Tracker was using direct callbacks to ipnlocal. This PR moves those to be triggered via the eventbus. Additionally, the eventbus is now closed on exit from tailscaled explicitly, and health is now a SubSystem in tsd. Updates #15160 Signed-off-by: Claus Lensbøl <claus@tailscale.com>
This commit is contained in:
@@ -236,7 +236,7 @@ func TestDirectProxyManual(t *testing.T) {
|
||||
},
|
||||
DiscoPublicKey: key.NewDisco().Public(),
|
||||
Logf: t.Logf,
|
||||
HealthTracker: &health.Tracker{},
|
||||
HealthTracker: health.NewTracker(bus),
|
||||
PopBrowserURL: func(url string) {
|
||||
t.Logf("PopBrowserURL: %q", url)
|
||||
},
|
||||
@@ -328,7 +328,7 @@ func testHTTPS(t *testing.T, withProxy bool) {
|
||||
},
|
||||
DiscoPublicKey: key.NewDisco().Public(),
|
||||
Logf: t.Logf,
|
||||
HealthTracker: &health.Tracker{},
|
||||
HealthTracker: health.NewTracker(bus),
|
||||
PopBrowserURL: func(url string) {
|
||||
t.Logf("PopBrowserURL: %q", url)
|
||||
},
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
"tailscale.com/types/logger"
|
||||
"tailscale.com/types/netmap"
|
||||
"tailscale.com/types/ptr"
|
||||
"tailscale.com/util/eventbus/eventbustest"
|
||||
"tailscale.com/util/mak"
|
||||
"tailscale.com/util/must"
|
||||
)
|
||||
@@ -1326,7 +1327,7 @@ func TestNetmapDisplayMessage(t *testing.T) {
|
||||
// [netmap.NetworkMap] to a [health.Tracker].
|
||||
func TestNetmapHealthIntegration(t *testing.T) {
|
||||
ms := newTestMapSession(t, nil)
|
||||
ht := health.Tracker{}
|
||||
ht := health.NewTracker(eventbustest.NewBus(t))
|
||||
|
||||
ht.SetIPNState("NeedsLogin", true)
|
||||
ht.GotStreamedMapResponse()
|
||||
@@ -1371,7 +1372,7 @@ func TestNetmapHealthIntegration(t *testing.T) {
|
||||
// passing the [netmap.NetworkMap] to a [health.Tracker].
|
||||
func TestNetmapDisplayMessageIntegration(t *testing.T) {
|
||||
ms := newTestMapSession(t, nil)
|
||||
ht := health.Tracker{}
|
||||
ht := health.NewTracker(eventbustest.NewBus(t))
|
||||
|
||||
ht.SetIPNState("NeedsLogin", true)
|
||||
ht.GotStreamedMapResponse()
|
||||
|
||||
Reference in New Issue
Block a user