Documentation ¶
Overview ¶
Package testutils provides utility types, for use in xds tests.
Index ¶
- Variables
- func BuildResourceName(typeName, auth, id string, ctxParams map[string]string) string
- func LocalityIDToProto(l internal.LocalityID) *v2corepb.Locality
- func ServerConfigForAddress(t *testing.T, addr string) *bootstrap.ServerConfig
- type AddLocalityOptions
- type ClusterLoadAssignmentBuilder
- type TestResourceWatcher
Constants ¶
This section is empty.
Variables ¶
var EmptyNodeProtoV2 = &v2corepb.Node{}
EmptyNodeProtoV2 is a v2 Node proto with no fields set.
var EmptyNodeProtoV3 = &v3corepb.Node{}
EmptyNodeProtoV3 is a v3 Node proto with no fields set.
Functions ¶
func BuildResourceName ¶ added in v1.44.0
BuildResourceName returns the resource name in the format of an xdstp:// resource.
func LocalityIDToProto ¶ added in v1.31.0
func LocalityIDToProto(l internal.LocalityID) *v2corepb.Locality
LocalityIDToProto converts a LocalityID to its proto representation.
func ServerConfigForAddress ¶ added in v1.54.0
func ServerConfigForAddress(t *testing.T, addr string) *bootstrap.ServerConfig
ServerConfigForAddress returns a bootstrap.ServerConfig for the given address with default values of insecure channel_creds and v3 server_features.
Types ¶
type AddLocalityOptions ¶ added in v1.32.0
type AddLocalityOptions struct { Health []v2corepb.HealthStatus Weight []uint32 }
AddLocalityOptions contains options when adding locality to the builder.
type ClusterLoadAssignmentBuilder ¶ added in v1.32.0
type ClusterLoadAssignmentBuilder struct {
// contains filtered or unexported fields
}
ClusterLoadAssignmentBuilder builds a ClusterLoadAssignment, aka EDS response.
func NewClusterLoadAssignmentBuilder ¶ added in v1.32.0
func NewClusterLoadAssignmentBuilder(clusterName string, dropPercents map[string]uint32) *ClusterLoadAssignmentBuilder
NewClusterLoadAssignmentBuilder creates a ClusterLoadAssignmentBuilder.
func (*ClusterLoadAssignmentBuilder) AddLocality ¶ added in v1.32.0
func (clab *ClusterLoadAssignmentBuilder) AddLocality(subzone string, weight uint32, priority uint32, addrsWithPort []string, opts *AddLocalityOptions)
AddLocality adds a locality to the builder.
func (*ClusterLoadAssignmentBuilder) Build ¶ added in v1.32.0
func (clab *ClusterLoadAssignmentBuilder) Build() *v2xdspb.ClusterLoadAssignment
Build builds ClusterLoadAssignment.
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 // ErrorCh is the channel on which errors from the xDS client are delivered. ErrorCh chan error // ResourceDoesNotExistCh is the channel used to indicate calls to OnResourceDoesNotExist ResourceDoesNotExistCh 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) OnError ¶ added in v1.54.0
func (w *TestResourceWatcher) OnError(err error)
OnError is invoked by the xDS client to report the latest error.
func (*TestResourceWatcher) OnResourceDoesNotExist ¶ added in v1.54.0
func (w *TestResourceWatcher) OnResourceDoesNotExist()
OnResourceDoesNotExist is used by the xDS client to report that the resource being watched no longer exists.
func (*TestResourceWatcher) OnUpdate ¶ added in v1.54.0
func (w *TestResourceWatcher) OnUpdate(data xdsresource.ResourceData)
OnUpdate is invoked by the xDS client to report the latest update on the resource being watched.
Directories ¶
Path | Synopsis |
---|---|
Package fakeclient provides a fake implementation of an xDS client.
|
Package fakeclient provides a fake implementation of an xDS client. |