e2e

package
v1.68.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package e2e contains utilities for end-to-end RouteLookupService tests.

Index

Constants

View Source
const (
	// RLSChildPolicyTargetNameField is a top-level field name to add to the child
	// policy's config, whose value is set to the target for the child policy.
	RLSChildPolicyTargetNameField = "Backend"
	// RLSChildPolicyBadTarget is a value which is considered a bad target by the
	// child policy. This is useful to test bad child policy configuration.
	RLSChildPolicyBadTarget = "bad-target"
)

Variables

View Source
var ErrParseConfigBadTarget = errors.New("backend field set to RLSChildPolicyBadTarget")

ErrParseConfigBadTarget is the error returned from ParseConfig when the backend field is set to RLSChildPolicyBadTarget.

Functions

func RegisterRLSChildPolicy

func RegisterRLSChildPolicy(name string, bf *BalancerFuncs)

RegisterRLSChildPolicy registers a balancer builder with the given name, to be used as a child policy for the RLS LB policy.

The child policy uses a pickfirst balancer under the hood to send all traffic to the single backend specified by the `RLSChildPolicyTargetNameField` field in its configuration which looks like: {"Backend": "Backend-address"}.

Types

type BalancerFuncs

type BalancerFuncs struct {
	UpdateClientConnState func(cfg *RLSChildPolicyConfig) error
	Close                 func()
}

BalancerFuncs is a set of callbacks which get invoked when the corresponding method on the child policy is invoked.

type RLSChildPolicyConfig

type RLSChildPolicyConfig struct {
	serviceconfig.LoadBalancingConfig
	Backend string // The target for which this child policy was created.
	Random  string // A random field to test child policy config changes.
}

RLSChildPolicyConfig is the LB config for the test child policy.

type RLSConfig

type RLSConfig struct {
	RouteLookupConfig                *rlspb.RouteLookupConfig
	RouteLookupChannelServiceConfig  string
	ChildPolicy                      *internalserviceconfig.BalancerConfig
	ChildPolicyConfigTargetFieldName string
}

RLSConfig is a utility type to build service config for the RLS LB policy.

func (*RLSConfig) LoadBalancingConfig

func (c *RLSConfig) LoadBalancingConfig() (serviceconfig.LoadBalancingConfig, error)

LoadBalancingConfig generates load balancing config which can used as part of a ClientConnState update to the RLS LB policy.

func (*RLSConfig) ServiceConfigJSON

func (c *RLSConfig) ServiceConfigJSON() (string, error)

ServiceConfigJSON generates service config with a load balancing config corresponding to the RLS LB policy.

Jump to

Keyboard shortcuts

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