execmockserver

package
v0.0.0-...-e834411 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package execmockserver implements the "net/rpc" based client/server pair which is used by execmock to communicate to/from mock subprocesses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIntercept

func ClientIntercept(runnerRegistry map[uint64]reflect.Value) (exitcode int, intercepted bool)

ClientIntercept will look for the LUCI_EXECMOCK_CTX environment variable, and, if found, invoke `cb` with an initialized Client as well as the input corresponding to this invocation.

The callback will execute the mock function with the decoded input, and then possibly call Client.SetInvocationOutput.

See go.chromium.org/luci/common/execmock

func RegisterInvocation

func RegisterInvocation[Out any](s *Server, InvocationInput *InvocationInput, outputFn func(Out, string, error)) (string, uint64)

RegisterInvocation registers an invocation and returns an environment variable which can be set for a subprocess which calls `Intercept()`.

Types

type InvocationInput

type InvocationInput struct {
	RunnerID    uint64
	RunnerInput any
	StartError  error
}

type InvocationOutput

type InvocationOutput struct {
	InvocationID uint64
	RunnerOutput any
	RunnerError  string
	RunnerPanic  string
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func Start

func Start() (ret *Server)

func (*Server) Close

func (e *Server) Close() error

func (*Server) GetInvocationInput

func (e *Server) GetInvocationInput(invocationID uint64, reply *InvocationInput) error

func (*Server) SetInvocationOutput

func (e *Server) SetInvocationOutput(InvocationOutput *InvocationOutput, none *int) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL