fauxrpctestcontainers

package module
v0.0.0-...-8b25004 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FauxRPCContainer

type FauxRPCContainer struct {
	testcontainers.Container
}

func Run

Run will start the testcontainers. You can pass in your own image name. It's advisable to avoid using the latest tag but if you want to, you would use "docker.io/sudorandom/fauxrpc:latest" See here for all available versions: https://hub.docker.com/r/sudorandom/fauxrpc

func (*FauxRPCContainer) AddFileDescriptor

func (c *FauxRPCContainer) AddFileDescriptor(ctx context.Context, fd protoreflect.FileDescriptor) error

MustAddFileDescriptor adds the given file descriptor to the FauxRPC registry.

func (*FauxRPCContainer) AddFiles

func (c *FauxRPCContainer) AddFiles(ctx context.Context, files *protoregistry.Files) error

AddFiles adds the given protoregistry.Files to the FauxRPC registry.

func (*FauxRPCContainer) AddFromPath

func (c *FauxRPCContainer) AddFromPath(ctx context.Context, path string) error

AddFromPath adds the given protoregistry.Files to the FauxRPC registry.

func (*FauxRPCContainer) AddStub

func (c *FauxRPCContainer) AddStub(ctx context.Context, target string, msg proto.Message) error

AddStub adds a stub to the FauxRPC stub database. Target is the full protobuf path to the type or service method.

Examples:

err := AddStub(ctx, "connectrpc.eliza.v1.SayResponse", &elizav1.SayResponse{Sentence: "example"})
err := AddStub(ctx, "connectrpc.eliza.v1.ElizaService/Say", &elizav1.SayResponse{Sentence: "example"})

func (*FauxRPCContainer) AddStubError

func (c *FauxRPCContainer) AddStubError(ctx context.Context, target string, msg string, code stubsv1.ErrorCode) error

AddStubError adds a stub error response to the FauxRPC stub database. A panic happens if anything fails.

Examples:

err := AddStub(ctx, "connectrpc.eliza.v1.SayResponse", "invalid argument", stubsv1.ErrorCode_ERROR_CODE_INVALID_ARGUMENT)
err := AddStub(ctx, "connectrpc.eliza.v1.ElizaService/Say", "not found", stubsv1.ErrorCode_ERROR_CODE_NOT_FOUND)

func (*FauxRPCContainer) BaseURL

func (c *FauxRPCContainer) BaseURL(ctx context.Context) (string, error)

BaseURL returns the base URL for the FauxRPC service. This will include a "http://" prefix.

func (*FauxRPCContainer) MustAddFileDescriptor

func (c *FauxRPCContainer) MustAddFileDescriptor(ctx context.Context, fd protoreflect.FileDescriptor)

MustAddFileDescriptor adds the given file descriptor to the FauxRPC registry. A panic happens if anything fails.

func (*FauxRPCContainer) MustAddFiles

func (c *FauxRPCContainer) MustAddFiles(ctx context.Context, files *protoregistry.Files)

MustAddFiles adds the given protoregistry.Files to the FauxRPC registry. A panic happens if anything fails.

func (*FauxRPCContainer) MustAddFromPath

func (c *FauxRPCContainer) MustAddFromPath(ctx context.Context, path string)

MustAddFromPath adds the given protoregistry.Files to the FauxRPC registry. A panic happens if anything fails.

func (*FauxRPCContainer) MustAddStub

func (c *FauxRPCContainer) MustAddStub(ctx context.Context, target string, msg proto.Message)

MustAddStub adds a stub to the FauxRPC stub database. A panic happens if anything fails.

func (*FauxRPCContainer) MustAddStubError

func (c *FauxRPCContainer) MustAddStubError(ctx context.Context, target string, msg string, code stubsv1.ErrorCode)

MustAddStubError adds a stub error response to the FauxRPC stub database. A panic happens if anything fails.

func (*FauxRPCContainer) MustBaseURL

func (c *FauxRPCContainer) MustBaseURL(ctx context.Context) string

MustBaseURL returns the base URL for the FauxRPC service. A panic happens if anything fails.

func (*FauxRPCContainer) MustRegistryClient

MustRegistryClient returns a client for managing types in the FauxRPC registry. A panic happens if anything fails.

func (*FauxRPCContainer) MustResetRegistry

func (c *FauxRPCContainer) MustResetRegistry(ctx context.Context)

MustResetRegistry resets the FauxRPC registry to an empty state. A panic happens if anything fails.

func (*FauxRPCContainer) MustResetStubs

func (c *FauxRPCContainer) MustResetStubs(ctx context.Context)

MustResetStubs resets the FauxRPC stub database to an empty state. A panic happens if anything fails.

func (*FauxRPCContainer) MustStubsClient

MustStubsClient returns a client for managing stubs in the FauxRPC registry. A panic happens if anything fails.

func (*FauxRPCContainer) RegistryClient

MustRegistryClient returns a client for managing types in the FauxRPC registry.

func (*FauxRPCContainer) ResetRegistry

func (c *FauxRPCContainer) ResetRegistry(ctx context.Context) error

ResetRegistry resets the FauxRPC registry to an empty state.

func (*FauxRPCContainer) ResetStubs

func (c *FauxRPCContainer) ResetStubs(ctx context.Context) error

MustResetStubs resets the FauxRPC stub database to an empty state.

func (*FauxRPCContainer) StubsClient

MustStubsClient returns a client for managing stubs in the FauxRPC registry.

Jump to

Keyboard shortcuts

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