testutils

package
v1.73.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package testutils provides utility types, for use in xds tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildResourceName added in v1.44.0

func BuildResourceName(typeName, auth, id string, ctxParams map[string]string) string

BuildResourceName returns the resource name in the format of an xdstp:// resource.

Types

type TestResourceWatcher added in v1.54.0

type TestResourceWatcher struct {
	// UpdateCh is the channel on which xDS client updates are delivered.
	UpdateCh chan *xdsresource.ResourceData
	// AmbientErrorCh is the channel on which ambient errors from the xDS
	// client are delivered.
	AmbientErrorCh chan error
	// ResourceErrorCh is the channel on which resource errors from the xDS
	// client are delivered.
	ResourceErrorCh chan struct{}
}

TestResourceWatcher implements the xdsresource.ResourceWatcher interface, used to receive updates on watches registered with the xDS client, when using the resource-type agnostic WatchResource API.

Tests can use the channels provided by this type to get access to updates and errors sent by the xDS client.

func NewTestResourceWatcher added in v1.54.0

func NewTestResourceWatcher() *TestResourceWatcher

NewTestResourceWatcher returns a TestResourceWatcher to watch for resources via the xDS client.

func (*TestResourceWatcher) AmbientError added in v1.73.0

func (w *TestResourceWatcher) AmbientError(err error, onDone func())

AmbientError is invoked by the xDS client to report the latest ambient error.

func (*TestResourceWatcher) ResourceChanged added in v1.73.0

func (w *TestResourceWatcher) ResourceChanged(data xdsresource.ResourceData, onDone func())

ResourceChanged is invoked by the xDS client to report the latest update.

func (*TestResourceWatcher) ResourceError added in v1.73.0

func (w *TestResourceWatcher) ResourceError(err error, onDone func())

ResourceError is invoked by the xDS client to report the latest error to stop watching the resource.

Directories

Path Synopsis
Package fakeclient provides a fake implementation of an xDS client.
Package fakeclient provides a fake implementation of an xDS client.

Jump to

Keyboard shortcuts

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