spyadapter

package
v0.0.0-...-48a44ca Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package spyadapter is intended for Mixer testing *ONLY*.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	Behavior    AdapterBehavior
	BuilderData *builderData
	HandlerData *handlerData
}

Adapter is a fake Adapter. It is used for controlling the Adapter's behavior as well as inspect the input values that adapter receives from Mixer

func NewSpyAdapter

func NewSpyAdapter(b AdapterBehavior) *Adapter

NewSpyAdapter returns a new instance of Adapter with the given behavior

func (*Adapter) GetAdptInfoFn

func (s *Adapter) GetAdptInfoFn() adapter.InfoFn

GetAdptInfoFn returns the infoFn for the Adapter.

type AdapterBehavior

type AdapterBehavior struct {
	Name    string
	Builder BuilderBehavior
	Handler HandlerBehavior
}

AdapterBehavior defines the behavior of the Adapter nolint: maligned

type BuilderBehavior

type BuilderBehavior struct {
	SetSampleReportTypesPanic  bool
	SetSampleCheckTypesPanic   bool
	SetCheckProducerTypesPanic bool
	SetSampleQuotaTypesPanic   bool

	SetAdapterConfigPanic bool

	ValidateErr   *adapter.ConfigErrors
	ValidatePanic bool

	BuildErr   error
	BuildPanic bool
}

BuilderBehavior defines the behavior of the Builder nolint: maligned

type CapturedCall

type CapturedCall struct {
	Name      string
	Instances []interface{}
}

CapturedCall describes a call into the adapter.

type HandlerBehavior

type HandlerBehavior struct {
	HandleSampleReportErr   error
	HandleSampleReportPanic bool
	HandleSampleReportSleep time.Duration

	HandleSampleCheckResult adapter.CheckResult
	HandleSampleCheckErr    error
	HandleSampleCheckPanic  bool
	HandleSampleCheckSleep  time.Duration

	HandleCheckProducerResult adapter.CheckResult
	HandleCheckProducerOutput *checkOutputTmpl.Output
	HandleCheckProducerErr    error
	HandleCheckProducerPanic  bool
	HandleCheckProducerSleep  time.Duration

	HandleSampleQuotaResult adapter.QuotaResult
	HandleSampleQuotaErr    error
	HandleSampleQuotaPanic  bool
	HandleSampleQuotaSleep  time.Duration

	GenerateSampleApaErr    error
	GenerateSampleApaOutput *apaTmpl.Output
	GenerateSampleApaPanic  bool
	GenerateSampleApaSleep  time.Duration

	CloseErr   error
	ClosePanic bool
}

HandlerBehavior defines the behavior of the Handler nolint: maligned

Directories

Path Synopsis
Package template contains generated code for the spy adapter testing.
Package template contains generated code for the spy adapter testing.
apa
Package sampleapa is a generated protocol buffer package.
Package sampleapa is a generated protocol buffer package.
check
Package samplecheck is a generated protocol buffer package.
Package samplecheck is a generated protocol buffer package.
checkoutput
Package checkproducer is a generated protocol buffer package.
Package checkproducer is a generated protocol buffer package.
quota
Package samplequota is a generated protocol buffer package.
Package samplequota is a generated protocol buffer package.
report
Package samplereport is a generated protocol buffer package.
Package samplereport is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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