testutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHttpServer

func NewHttpServer(mux *http.ServeMux) (server *httptest.Server)

func NewHttpsServer

func NewHttpsServer(mux *http.ServeMux) (server *httptest.Server)

func NewSecondaryProxy

func NewSecondaryProxy(t testing.TB, s *HttpServers) (net.Listener, string)

Types

type BrowserControllerRequest added in v0.8.0

type BrowserControllerRequest struct {
	RegisterResource *browsercontrollerV2.RegisterResourceRequest
	CompleteResource *browsercontrollerV2.CompleteResourceRequest
}

type ConstantCacheHandler

type ConstantCacheHandler string

func (ConstantCacheHandler) ServeHTTP

type ConstantHandler

type ConstantHandler string

func (ConstantHandler) ServeHTTP

func (h ConstantHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ConstantSlowHandler

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

func NewConstantSlowHandler

func NewConstantSlowHandler(response string, waitMillis int) *ConstantSlowHandler

func (ConstantSlowHandler) ServeHTTP

func (h ConstantSlowHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GrpcServiceMock

type GrpcServiceMock struct {
	dnsresolverV1.UnimplementedDnsResolverServer
	contentwriterV1.UnimplementedContentWriterServer
	browsercontrollerV2.UnimplementedBrowserControllerServer

	Requests Requests
	DoneBC   chan bool
	DoneCW   chan bool

	Server     *grpc.Server
	ClientConn *serviceconnections.Connections
	// contains filtered or unexported fields
}

*

  • Server mocks

func NewGrpcServiceMock

func NewGrpcServiceMock(opts ...MockOption) *GrpcServiceMock

func (*GrpcServiceMock) Clear

func (s *GrpcServiceMock) Clear()

func (*GrpcServiceMock) Close

func (s *GrpcServiceMock) Close()

func (*GrpcServiceMock) CompleteResource added in v0.8.0

func (*GrpcServiceMock) RegisterResource added in v0.8.0

func (*GrpcServiceMock) Resolve

Implements DNS service

func (*GrpcServiceMock) Write

Implements ContentWriterService

type HttpServers

type HttpServers struct {
	SrvHttp         *httptest.Server
	SrvHttps        *httptest.Server
	SrvHttpsBadCert *httptest.Server
	// contains filtered or unexported fields
}

HttpServers contains test servers for HTTP and HTTPS

func NewHttpServers

func NewHttpServers(t testing.TB) *HttpServers

func (*HttpServers) Close

func (s *HttpServers) Close()

type MockOption

type MockOption interface {
	// contains filtered or unexported methods
}

ConnectionOption configures how we parse a URL.

func WithExternalBrowserController

func WithExternalBrowserController(option *serviceconnections.ConnectionOptions) MockOption

func WithExternalContentWriter

func WithExternalContentWriter(option *serviceconnections.ConnectionOptions) MockOption

type Requests

type Requests struct {
	BrowserControllerRequests []*BrowserControllerRequest
	DnsResolverRequests       []*dnsresolverV1.ResolveRequest
	ContentWriterRequests     []*contentwriterV1.WriteRequest
}

Jump to

Keyboard shortcuts

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