adaptertest

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package adaptertest is a generated GoMock package.

Package adaptertest grants the copilot adapter's specs the capabilities a binary grants in production, without leaving the process: the adapter's store on pgmem with its real schema applied, and the adapter's HTTP surface served by the ipc/net/http listener over an in-memory connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IReporter

type IReporter interface {
	Helper()
	Errorf(format string, arguments ...any)
	Fatalf(format string, arguments ...any)
	Cleanup(cleanup func())
}

IReporter is the part of a spec runner the capabilities are opened against: GinkgoT() and *testing.T both satisfy it.

type MemoryStore

type MemoryStore struct {
	*store.PostgresStore
	// contains filtered or unexported fields
}

MemoryStore is the adapter's store over one pgmem database of its own. Close releases the database.

func OpenMemoryStore

func OpenMemoryStore(ctx context.Context) (*MemoryStore, error)

OpenMemoryStore applies the adapter's schema to a new pgmem database and returns the store over it.

func OpenStore

func OpenStore(reporter IReporter) *MemoryStore

OpenStore opens a store for one spec and closes it when the spec ends; a store that cannot be opened fails the spec.

func (*MemoryStore) Close

func (opened *MemoryStore) Close() error

Close releases the pgmem database.

func (*MemoryStore) Database

func (opened *MemoryStore) Database() csfpg.IDB

Database is the csfpg capability the store runs on, for a spec that reads the rows the store wrote or binds a second store to the same database.

type MockIDialer

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

MockIDialer is a mock of IDialer interface.

func NewMockIDialer

func NewMockIDialer(ctrl *gomock.Controller) *MockIDialer

NewMockIDialer creates a new mock instance.

func (*MockIDialer) DialContext

func (m *MockIDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

DialContext mocks base method.

func (*MockIDialer) EXPECT

func (m *MockIDialer) EXPECT() *MockIDialerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

type MockIDialerMockRecorder

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

MockIDialerMockRecorder is the mock recorder for MockIDialer.

func (*MockIDialerMockRecorder) DialContext

func (mr *MockIDialerMockRecorder) DialContext(ctx, network, address any) *gomock.Call

DialContext indicates an expected call of DialContext.

type MockIListener

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

MockIListener is a mock of IListener interface.

func NewMockIListener

func NewMockIListener(ctrl *gomock.Controller) *MockIListener

NewMockIListener creates a new mock instance.

func (*MockIListener) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockIListener) Listen

func (m *MockIListener) Listen(ctx context.Context, network, address string) (net.Listener, error)

Listen mocks base method.

type MockIListenerMockRecorder

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

MockIListenerMockRecorder is the mock recorder for MockIListener.

func (*MockIListenerMockRecorder) Listen

func (mr *MockIListenerMockRecorder) Listen(ctx, network, address any) *gomock.Call

Listen indicates an expected call of Listen.

type Server

type Server struct {
	// URL is the base URL Client reaches the handler at.
	URL string
	// Client dials through the ipc/net/http client capability.
	Client *http.Client
}

Server is a handler served the way the binary serves it — by the ipc/net/http listener, mounted in a runtime scope — over an in-memory connection that a gomock socket capability hands to both ends.

func Serve

func Serve(reporter IReporter, handler http.Handler) *Server

Serve starts handler for one spec and stops it, joining every serving goroutine, when the spec ends.

Jump to

Keyboard shortcuts

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