testutil

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: Apache-2.0 Imports: 37 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(s *HttpServers) (net.Listener, string)

Types

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
	browsercontrollerV1.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) Do

Implements BrowserController

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() *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 []*browsercontrollerV1.DoRequest
	DnsResolverRequests       []*dnsresolverV1.ResolveRequest
	ContentWriterRequests     []*contentwriterV1.WriteRequest
}

Jump to

Keyboard shortcuts

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