ipn/ipn{server,test}: extract the LocalAPI test client and server into ipntest
In this PR, we extract the in-process LocalAPI client/server implementation from ipn/ipnserver/server_test.go into a new ipntest package to be used in high‑level black‑box tests, such as those for the tailscale CLI. Updates #15575 Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
@@ -179,6 +179,12 @@ func contextWithActor(ctx context.Context, logf logger.Logf, c net.Conn) context
|
||||
return actorKey.WithValue(ctx, actorOrError{actor: actor, err: err})
|
||||
}
|
||||
|
||||
// NewContextWithActorForTest returns a new context that carries the identity
|
||||
// of the specified actor. It is used in tests only.
|
||||
func NewContextWithActorForTest(ctx context.Context, actor ipnauth.Actor) context.Context {
|
||||
return actorKey.WithValue(ctx, actorOrError{actor: actor})
|
||||
}
|
||||
|
||||
// actorFromContext returns an [ipnauth.Actor] associated with ctx,
|
||||
// or an error if the context does not carry an actor's identity.
|
||||
func actorFromContext(ctx context.Context) (ipnauth.Actor, error) {
|
||||
|
||||
Reference in New Issue
Block a user