runner

package
v0.0.0-...-f1a479f Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Test suite builders for each of the variants.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateResults

func UpdateResults(current types.Results, variantResults types.VariantResults) types.Results

Types

type ADSBuilder

type ADSBuilder struct {
	Name     string
	Channels *Channels
	Sotw     *Sotw
	Delta    *Delta
}

type CDSBuilder

type CDSBuilder struct {
	Name     string
	Channels *Channels
	Sotw     *Sotw
	Delta    *Delta
}

type Cache

type Cache struct {
	// StartState     *pb.Snapshot
	// StateSnapshots []*pb.Snapshot
	FinalResponse *discovery.DiscoveryResponse
}

type Channels

type Channels struct {
	Req  chan *anypb.Any // will be a discoveryRequest or a deltaDiscoveryRequest
	Res  chan *anypb.Any // will be a discoveryResponse or a deltadiscoveryResponse
	Err  chan error
	Done chan bool
}

type ClientConfig

type ClientConfig struct {
	Port string
	Conn *grpc.ClientConn
}

type Context

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

type Delta

type Delta struct {
	Stream  DeltaStream
	Context Context
}

type DeltaStream

type DeltaStream interface {
	Send(*discovery.DeltaDiscoveryRequest) error
	Recv() (*discovery.DeltaDiscoveryResponse, error)
	CloseSend() error
}

type EDSBuilder

type EDSBuilder struct {
	Name     string
	Channels *Channels
	Sotw     *Sotw
	Delta    *Delta
}

type LDSBuilder

type LDSBuilder struct {
	Name     string
	Channels *Channels
	Sotw     *Sotw
	Delta    *Delta
}

type RDSBuilder

type RDSBuilder struct {
	Name     string
	Channels *Channels
	Sotw     *Sotw
	Delta    *Delta
}

type Runner

type Runner struct {
	Adapter          *ClientConfig
	Target           *ClientConfig
	NodeID           string
	Cache            *Cache
	Aggregated       bool
	Incremental      bool
	Service          *XDSService
	SubscribeRequest *any.Any
	Validate         *Validate
}

func FreshRunner

func FreshRunner(current ...*Runner) *Runner

func (*Runner) Ack

func (r *Runner) Ack(service *XDSService)

func (*Runner) ClientDoesAWildcardSubscriptionToService

func (r *Runner) ClientDoesAWildcardSubscriptionToService(service string) error

Wrapper to start stream, without resources, for given service

func (*Runner) ClientDoesNotReceiveAnyMessageFromService

func (r *Runner) ClientDoesNotReceiveAnyMessageFromService(service string) error

func (*Runner) ClientDoesNotReceiveResourceOfServiceAtVersion

func (r *Runner) ClientDoesNotReceiveResourceOfServiceAtVersion(resource, service, version string) error

func (*Runner) ClientReceivesNoticeThatResourceWasRemovedForService

func (r *Runner) ClientReceivesNoticeThatResourceWasRemovedForService(resource, service string) error

func (*Runner) ClientReceivesOnlyTheResourceAndVersionForTheService

func (r *Runner) ClientReceivesOnlyTheResourceAndVersionForTheService(resource, version, service string) error

Loop again, but this time continuing if resource in cache has more than one entry. The test is itended for when you update a subscription to now only care about a single resource. The response you reeceive should only have a single entry in its resources, otherwise we fail. Won't work for LDS/CDS where it is conformant to pass along more than you need.

func (*Runner) ClientReceivesResourcesAndVersionForService

func (r *Runner) ClientReceivesResourcesAndVersionForService(resources, version, service string) error

Loop through the service's response cache until we get the expected response or we reach the deadline for the service.

func (*Runner) ClientSubscribesToASubsetOfResourcesForService

func (r *Runner) ClientSubscribesToASubsetOfResourcesForService(subset, service string) error

func (*Runner) ClientSubscribesToServiceForResources

func (r *Runner) ClientSubscribesToServiceForResources(srv string, resources []string) error

Takes service and creates a runner.Service with a fresh xDS stream for the given service. This is the heart of a test, as it sets up the request/response loops that verify the service is working properly.

func (*Runner) ClientUnsubscribesFromAllResourcesForService

func (r *Runner) ClientUnsubscribesFromAllResourcesForService(service string) error

func (*Runner) ClientUnsubscribesFromResourceForService

func (r *Runner) ClientUnsubscribesFromResourceForService(resource, service string) error

A delta specific test, as delta can explicitly unsubscribe, whereas sotw can only update their subscription set up a delta discovery request unsubscribing for given resource, and pass it along the channel.

func (*Runner) ClientUpdatesSubscriptionToAResourceForServiceWithVersion

func (r *Runner) ClientUpdatesSubscriptionToAResourceForServiceWithVersion(resource, service, version string) error

func (*Runner) ConnectClient

func (r *Runner) ConnectClient(server, address string) error

func (*Runner) DeltaStream

func (r *Runner) DeltaStream(service *XDSService)

Bidirectioinal stream between client and server. Listens for any responses from server and sends them along the response channel. Listens to new requests from the request channel and sends them along to the server.

func (*Runner) LoadSteps

func (r *Runner) LoadSteps(ctx *godog.ScenarioContext)

func (*Runner) NoOtherResourceHasSameNonce

func (r *Runner) NoOtherResourceHasSameNonce(service, resource string) error

func (*Runner) NoOtherResourceHasSameVersionOrNonce

func (r *Runner) NoOtherResourceHasSameVersionOrNonce(service, resource string) error

func (*Runner) ResourceIsAddedToServiceWithVersion

func (r *Runner) ResourceIsAddedToServiceWithVersion(resource, service, version string) error

func (*Runner) ResourceIsRemovedFromTheService

func (r *Runner) ResourceIsRemovedFromTheService(resource, service string) error

func (*Runner) ResourceOfServiceIsUpdatedToVersion

func (r *Runner) ResourceOfServiceIsUpdatedToVersion(resource, service, version string) error

func (*Runner) ResourcesAndVersionForServiceCameInASingleResponse

func (r *Runner) ResourcesAndVersionForServiceCameInASingleResponse(resources, version, service string) error

func (*Runner) SotwStream

func (r *Runner) SotwStream(service *XDSService)

func (*Runner) Stream

func (r *Runner) Stream(service *XDSService)

func (*Runner) TargetSetupWithServiceResourcesAndVersion

func (r *Runner) TargetSetupWithServiceResourcesAndVersion(services, resources, version string) error

Creates a snapshot to be sent, via the adapter, to the target implementation, setting the state for the rest of the steps.

func (*Runner) TheServiceNeverRespondsMoreThanNecessary

func (r *Runner) TheServiceNeverRespondsMoreThanNecessary() error

ctx.Step(`^the service never responds more than necessary$`, r.TheServiceNeverRespondsMoreThanNecessary)

type Sotw

type Sotw struct {
	Stream  SotwStream
	Context Context
}

type SotwStream

type SotwStream interface {
	Send(*discovery.DiscoveryRequest) error
	Recv() (*discovery.DiscoveryResponse, error)
	CloseSend() error
}

type Suite

type Suite struct {
	Variant     types.Variant
	Runner      *Runner
	Aggregated  bool
	Incremental bool
	TestWriting bool
	Buffer      bytes.Buffer
	Tags        string
	TestSuite   godog.TestSuite
}

func NewIncrementalAggregatedSuite

func NewIncrementalAggregatedSuite(testWriting bool) *Suite

func NewIncrementalNonAggregatedSuite

func NewIncrementalNonAggregatedSuite(testWriting bool) *Suite

func NewSotwAggregatedSuite

func NewSotwAggregatedSuite(testWriting bool) *Suite

func NewSotwNonAggregatedSuite

func NewSotwNonAggregatedSuite(testWriting bool) *Suite

func NewSuite

func NewSuite(variant types.Variant, testWriting bool) *Suite

func (*Suite) ConfigureSuite

func (s *Suite) ConfigureSuite()

func (*Suite) Run

func (s *Suite) Run() (results types.VariantResults, err error)

func (*Suite) SetTags

func (s *Suite) SetTags(base string) error

func (*Suite) StartRunner

func (s *Suite) StartRunner(node, adapter, target string) error

type Validate

type Validate struct {
	RequestCount     int
	ResponseCount    int
	Resources        map[string]map[string]ValidateResource
	RemovedResources map[string]map[string]ValidateResource
}

func NewValidate

func NewValidate() *Validate

type ValidateResource

type ValidateResource struct {
	Version string
	Nonce   string
}

type XDSService

type XDSService struct {
	Name     string
	Channels *Channels
	Sotw     *Sotw
	Delta    *Delta
}

Jump to

Keyboard shortcuts

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