testutil

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorFunc

type ErrorFunc func(*commonsV1.Error)

type FrontierMock

type FrontierMock struct {
	frontierV1.UnimplementedFrontierServer

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

*

  • Server mocks

func NewFrontierMock

func NewFrontierMock(requestPageFunc RequestPageFunc, errorFunc ErrorFunc, metricsFunc MetricsFunc, outlinkFunc OutlinkFunc) *FrontierMock

func (*FrontierMock) BufDialerOption

func (m *FrontierMock) BufDialerOption() grpc.DialOption

func (*FrontierMock) Close

func (m *FrontierMock) Close()

func (*FrontierMock) CrawlSeed

Implements Frontier

func (*FrontierMock) GetNextPage

Implements Frontier

type MetricsFunc

type MetricsFunc func(*frontierV1.PageHarvest_Metrics)

type OutlinkFunc

type OutlinkFunc func(*frontierV1.QueuedUri)

type RequestPageFunc

type RequestPageFunc func() (qUri *frontierV1.QueuedUri, crawlConfig *configV1.ConfigObject)

type RobotsEvaluatorMock added in v0.1.3

type RobotsEvaluatorMock struct {
	// optional function to call at connect time
	ConnectFunc func() error
	// optional function to call when RobotsEvaluator is closing
	CloseFunc func() error
	// optional function to call when IsAllowed is called on RobotsEvaluator. IsAllowed will always return true if this
	// is not set
	IsAllowedFunc func(*robotsevaluatorV1.IsAllowedRequest) bool
}

RobotsEvaluatorMock is a helper structure for mocking robotsevaluator.RobotsEvaluator

func (*RobotsEvaluatorMock) Close added in v0.1.3

func (r *RobotsEvaluatorMock) Close() error

func (*RobotsEvaluatorMock) Connect added in v0.1.3

func (r *RobotsEvaluatorMock) Connect() error

func (*RobotsEvaluatorMock) IsAllowed added in v0.1.3

type ScreenshotWriterMock added in v0.1.3

type ScreenshotWriterMock struct {
	// optional function to call at connect time
	ConnectFunc func() error
	// optional function to call when RobotsEvaluator is closing
	CloseFunc func() error
	// optional function to call when Write is called on ScreenshotWriter. Write will always return nil if this
	// is not set
	WriteFunc func(data []byte, metadata screenshotwriter.Metadata) error
}

ScreenshotWriterMock is a helper structure for mocking screenshotwriter.ScreenshotWriter

func (*ScreenshotWriterMock) Close added in v0.1.3

func (s *ScreenshotWriterMock) Close() error

func (*ScreenshotWriterMock) Connect added in v0.1.3

func (s *ScreenshotWriterMock) Connect() error

func (*ScreenshotWriterMock) Write added in v0.1.3

func (s *ScreenshotWriterMock) Write(_ context.Context, data []byte, metadata screenshotwriter.Metadata) error

Jump to

Keyboard shortcuts

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