Documentation ¶
Index ¶
- Constants
- Variables
- func PluginLoggerTestHandshakeConfig() plugin.HandshakeConfig
- func PluginTest[TB testing.TB, I any](tb TB, name string, p plugin.Plugin, testFn func(TB, I))
- type Client
- type GRPCPluginLoggerTest
- type GRPCScaffold
- type HelperProcessCommand
- type MockDep
- type Server
- type SetupGRPCClient
- type SetupGRPCServer
Constants ¶
const ( PANIC = iota FATAL CRITICAL ERROR INFO WARN DEBUG )
const ConfigTOML = `[Foo]
Bar = "Baz"
`
const PluginLoggerTestName = "logger-test"
Variables ¶
var ( //CapabilitiesRegistry GetID = "get-id" GetTriggerID = "get-trigger-id" GetActionID = "get-action-id" GetConsensusID = "get-consensus-id" GetTargetID = "get-target-id" CapabilityInfo = capabilities.CapabilityInfo{ ID: "capability-info-id@1.0.0", CapabilityType: capabilities.CapabilityTypeAction, Description: "capability-info-description", } )
Functions ¶
func PluginLoggerTestHandshakeConfig ¶
func PluginLoggerTestHandshakeConfig() plugin.HandshakeConfig
Types ¶
type GRPCPluginLoggerTest ¶
type GRPCPluginLoggerTest struct { plugin.NetRPCUnsupportedPlugin logger.SugaredLogger ErrorType int }
NOTE: This is part of the test package because it needs to be imported by the test binary at `./internal/test/cmd` as well as the test at `./pkg/loop/logger_loop_test.go`
func (*GRPCPluginLoggerTest) ClientConfig ¶
func (g *GRPCPluginLoggerTest) ClientConfig() *plugin.ClientConfig
func (*GRPCPluginLoggerTest) GRPCClient ¶
func (g *GRPCPluginLoggerTest) GRPCClient(context.Context, *plugin.GRPCBroker, *grpc.ClientConn) (interface{}, error)
func (*GRPCPluginLoggerTest) GRPCServer ¶
func (g *GRPCPluginLoggerTest) GRPCServer(*plugin.GRPCBroker, *grpc.Server) (err error)
type GRPCScaffold ¶
GRPCScaffold is a test scaffold for grpc tests
func NewGRPCScaffold ¶
func NewGRPCScaffold[T Client, S any](t *testing.T, serverFn SetupGRPCServer[S], clientFn SetupGRPCClient[T]) *GRPCScaffold[T, S]
func (*GRPCScaffold[T, S]) Client ¶
func (t *GRPCScaffold[T, S]) Client() T
func (*GRPCScaffold[T, S]) Close ¶
func (t *GRPCScaffold[T, S]) Close()
Caller must either call Close() on the returned GRPCScaffold or manually close the Client. some implementations in our suite of LOOPPs release server resources on client.Close() and in that case, the caller should call Client().Close() and test that the server resources are released
func (*GRPCScaffold[T, S]) Server ¶
func (t *GRPCScaffold[T, S]) Server() S
type HelperProcessCommand ¶
type HelperProcessCommand struct { Limit int CommandLocation string Command string StaticChecks bool ThrowErrorType int }
func (HelperProcessCommand) New ¶
func (h HelperProcessCommand) New() *exec.Cmd
type MockDep ¶
type MockDep struct {
// contains filtered or unexported fields
}
MockDep is a mock dependency that can be used to test that a grpc client closes its dependencies to be used in tests that require a grpc client to close its dependencies
type SetupGRPCClient ¶
type SetupGRPCClient[T Client] func(b *loopnet.BrokerExt, conn grpc.ClientConnInterface) T
SetupGRPCClient is a function that sets up a grpc client with a given broker and connection analogous to SetupGRPCServer. Typically it is implemented as a light wrapper around the grpc client constructor
type SetupGRPCServer ¶
SetupGRPCServer is a function that sets up a grpc server with a given broker typical and expected usage is to instantiate a grpc server implementation with a static test interface implementation and then register that grpc server e.g. ```
func setupCCIPCommitProviderGRPCServer(t *testing.T, s *grpc.Server, b *loopnet.BrokerExt) *grpc.Server { commitProvider := ccip.NewCommitProviderServer(CommitProvider, b) ccippb.RegisterCommitCustomHandlersServer(s, commitProvider) return s }
```