ipn/ipnlocal,wgengine/magicsock: use eventbus for node & filter updates (#16271)
nodeBackend now publishes filter and node changes to eventbus topics that are consumed by magicsock.Conn Updates tailscale/corp#27502 Updates tailscale/corp#29543 Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
@@ -8,10 +8,12 @@ import (
|
||||
"errors"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"tailscale.com/util/eventbus"
|
||||
)
|
||||
|
||||
func TestNodeBackendReadiness(t *testing.T) {
|
||||
nb := newNodeBackend(t.Context())
|
||||
nb := newNodeBackend(t.Context(), eventbus.New())
|
||||
|
||||
// The node backend is not ready until [nodeBackend.ready] is called,
|
||||
// and [nodeBackend.Wait] should fail with [context.DeadlineExceeded].
|
||||
@@ -42,7 +44,7 @@ func TestNodeBackendReadiness(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNodeBackendShutdown(t *testing.T) {
|
||||
nb := newNodeBackend(t.Context())
|
||||
nb := newNodeBackend(t.Context(), eventbus.New())
|
||||
|
||||
shutdownCause := errors.New("test shutdown")
|
||||
|
||||
@@ -80,7 +82,7 @@ func TestNodeBackendShutdown(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNodeBackendReadyAfterShutdown(t *testing.T) {
|
||||
nb := newNodeBackend(t.Context())
|
||||
nb := newNodeBackend(t.Context(), eventbus.New())
|
||||
|
||||
shutdownCause := errors.New("test shutdown")
|
||||
nb.shutdown(shutdownCause)
|
||||
@@ -92,7 +94,7 @@ func TestNodeBackendReadyAfterShutdown(t *testing.T) {
|
||||
|
||||
func TestNodeBackendParentContextCancellation(t *testing.T) {
|
||||
ctx, cancelCtx := context.WithCancel(context.Background())
|
||||
nb := newNodeBackend(ctx)
|
||||
nb := newNodeBackend(ctx, eventbus.New())
|
||||
|
||||
cancelCtx()
|
||||
|
||||
@@ -109,7 +111,7 @@ func TestNodeBackendParentContextCancellation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNodeBackendConcurrentReadyAndShutdown(t *testing.T) {
|
||||
nb := newNodeBackend(t.Context())
|
||||
nb := newNodeBackend(t.Context(), eventbus.New())
|
||||
|
||||
// Calling [nodeBackend.ready] and [nodeBackend.shutdown] concurrently
|
||||
// should not cause issues, and [nodeBackend.Wait] should unblock,
|
||||
|
||||
Reference in New Issue
Block a user