test

package
v0.0.0-...-70c9054 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K8sNamespace = "e2e-test"
)

Variables

View Source
var (
	DiscoveryLabel = "testing.kubernetes.io"
)

Functions

func GetTargets

func GetTargets(targetGroup *vpclattice.TargetGroupSummary, deployment *appsv1.Deployment, env *Framework, ctx context.Context) ([]string, []*vpclattice.TargetSummary)

func Logger

func Logger(ctx context.Context) *zap.SugaredLogger

func MustMerge

func MustMerge[T interface{}](dest T, srcs ...T) T

func New

func New[T client.Object](t T, mergeFrom ...T) T

func NewContext

func NewContext(t *testing.T) context.Context

func NewGrpcurlRunnerPod

func NewGrpcurlRunnerPod(name, namespace string) *v1.Pod

https://github.com/fullstorydev/grpcurl

func RandomName

func RandomName() string

Types

type ElasticSearchOptions

type ElasticSearchOptions struct {
	Name                string
	Namespace           string // the object will be created in this namespace
	Port                int
	TargetPort          int
	Port2               int
	TargetPort2         int
	MergeFromDeployment []*appsv1.Deployment
	MergeFromService    []*v1.Service
	ReadinessGate       bool
}

type Framework

type Framework struct {
	client.Client

	Log           gwlog.Logger
	LatticeClient services.Lattice
	TaggingClient services.Tagging
	Ec2Client     *ec2.EC2
	GrpcurlRunner *corev1.Pod
	DefaultTags   services.Tags
	Cloud         anaws.Cloud
	// contains filtered or unexported fields
}

func NewFramework

func NewFramework(ctx context.Context, log gwlog.Logger, testNamespace string) *Framework

func (*Framework) AreAllLatticeTargetsHealthy

func (env *Framework) AreAllLatticeTargetsHealthy(ctx context.Context, tg *vpclattice.TargetGroupSummary) (bool, error)

func (*Framework) CreateServiceExport

func (env *Framework) CreateServiceExport(service *v1.Service) *anv1alpha1.ServiceExport

func (*Framework) CreateServiceExportAndServiceImportByService

func (env *Framework) CreateServiceExportAndServiceImportByService(service *v1.Service) (*anv1alpha1.ServiceExport, *anv1alpha1.ServiceImport)

func (*Framework) CreateServiceImport

func (env *Framework) CreateServiceImport(service *v1.Service) *anv1alpha1.ServiceImport

func (*Framework) EventuallyExpectNoneFound

func (env *Framework) EventuallyExpectNoneFound(ctx context.Context, objectList client.ObjectList)

func (*Framework) EventuallyExpectNotFound

func (env *Framework) EventuallyExpectNotFound(ctx context.Context, objects ...client.Object)

func (*Framework) ExpectCreated

func (env *Framework) ExpectCreated(ctx context.Context, objects ...client.Object)

func (*Framework) ExpectDeleteAllToSucceed

func (env *Framework) ExpectDeleteAllToSucceed(ctx context.Context, object client.Object, namespace string)

func (*Framework) ExpectDeleted

func (env *Framework) ExpectDeleted(ctx context.Context, objects ...client.Object)

func (*Framework) ExpectDeletedThenNotFound

func (env *Framework) ExpectDeletedThenNotFound(ctx context.Context, objects ...client.Object)

func (*Framework) ExpectToBeClean

func (env *Framework) ExpectToBeClean(ctx context.Context)

func (*Framework) ExpectUpdated

func (env *Framework) ExpectUpdated(ctx context.Context, objects ...client.Object)

func (*Framework) FindTargetGroupFromSpec

func (env *Framework) FindTargetGroupFromSpec(ctx context.Context, tgSpec model.TargetGroupSpec) (*vpclattice.TargetGroupSummary, error)

func (*Framework) GetAllTargets

func (env *Framework) GetAllTargets(ctx context.Context, targetGroup *vpclattice.TargetGroupSummary, deployment *appsv1.Deployment) ([]string, []*vpclattice.TargetSummary)

func (*Framework) GetFullTargetGroupFromSummary

func (env *Framework) GetFullTargetGroupFromSummary(
	ctx context.Context,
	tgSummary *vpclattice.TargetGroupSummary) *vpclattice.GetTargetGroupOutput

func (*Framework) GetLatticeServiceHttpsListenerNonDefaultRules

func (env *Framework) GetLatticeServiceHttpsListenerNonDefaultRules(ctx context.Context, vpcLatticeService *vpclattice.ServiceSummary) ([]*vpclattice.GetRuleOutput, error)

func (*Framework) GetPodsByDeploymentName

func (env *Framework) GetPodsByDeploymentName(deploymentName string, deploymentNamespce string) []corev1.Pod

func (*Framework) GetServiceNetwork

func (env *Framework) GetServiceNetwork(ctx context.Context, gateway *gwv1.Gateway) *vpclattice.ServiceNetworkSummary

func (*Framework) GetTargetGroup

func (env *Framework) GetTargetGroup(ctx context.Context, service *corev1.Service) *vpclattice.TargetGroupSummary

func (*Framework) GetTargetGroupWithProtocol

func (env *Framework) GetTargetGroupWithProtocol(ctx context.Context, service *corev1.Service, protocol, protocolVersion string) *vpclattice.TargetGroupSummary

func (*Framework) GetTargets

func (env *Framework) GetTargets(ctx context.Context, targetGroup *vpclattice.TargetGroupSummary, deployment *appsv1.Deployment) []*vpclattice.TargetSummary

TODO: Create a new function that only verifying deployment len(podList.Items)==*deployment.Spec.Replicas, and don't do lattice.ListTargets() api call

func (*Framework) GetVpcLatticeService

func (env *Framework) GetVpcLatticeService(ctx context.Context, route core.Route) *vpclattice.ServiceSummary

func (*Framework) GetVpcLatticeServiceDns

func (env *Framework) GetVpcLatticeServiceDns(httpRouteName string, httpRouteNamespace string) string

func (*Framework) IsVpcAssociatedWithServiceNetwork

func (env *Framework) IsVpcAssociatedWithServiceNetwork(ctx context.Context, vpcId string, serviceNetwork *vpclattice.ServiceNetworkSummary) (bool, *vpclattice.ServiceNetworkVpcAssociationSummary, error)

func (*Framework) NewGRPCRoute

func (env *Framework) NewGRPCRoute(namespace string, parentRefsGateway *gwv1.Gateway, rules []v1alpha2.GRPCRouteRule) *v1alpha2.GRPCRoute

func (*Framework) NewGateway

func (env *Framework) NewGateway(name string, namespace string) *gwv1.Gateway

func (*Framework) NewGrpcBin

func (env *Framework) NewGrpcBin(options GrpcAppOptions) (*appsv1.Deployment, *v1.Service)

https://github.com/moul/grpcbin

func (*Framework) NewHeaderMatchHttpRoute

func (env *Framework) NewHeaderMatchHttpRoute(parentRefsGateway *gwv1.Gateway, services []*v1.Service) *gwv1.HTTPRoute

func (*Framework) NewHttpApp

func (env *Framework) NewHttpApp(options HTTPAppOptions) (*appsv1.Deployment, *v1.Service)

func (*Framework) NewHttpRoute

func (env *Framework) NewHttpRoute(parentRefsGateway *gwv1.Gateway, service *v1.Service, kind string) *gwv1.HTTPRoute

func (*Framework) NewMethodMatchHttpRoute

func (env *Framework) NewMethodMatchHttpRoute(parentRefsGateway *gwv1.Gateway, getService *v1.Service, postService *v1.Service,
	httpRouteName string, namespace string) *gwv1.HTTPRoute

creates a route sending GET to getService and POST to postService

func (*Framework) NewNginxApp

func (env *Framework) NewNginxApp(options ElasticSearchOptions) (*appsv1.Deployment, *v1.Service)

func (*Framework) NewPathMatchHttpRoute

func (env *Framework) NewPathMatchHttpRoute(parentRefsGateway *gwv1.Gateway, backendRefObjects []client.Object,
	gwListenerSectionName string, name string, namespace string) *gwv1.HTTPRoute

func (*Framework) NewTestTags

func (env *Framework) NewTestTags(testSuite string) map[string]*string

func (*Framework) NewWeightedRoutingHttpRoute

func (env *Framework) NewWeightedRoutingHttpRoute(parentRefsGateway *gwv1.Gateway, backendRefObjectAndWeights []*ObjectAndWeight,
	gwListenerSectionNames []string) *gwv1.HTTPRoute

func (*Framework) SleepForRouteUpdate

func (env *Framework) SleepForRouteUpdate()

func (*Framework) VerifyTargetGroupNotFound

func (env *Framework) VerifyTargetGroupNotFound(tg *vpclattice.TargetGroupSummary)

type GrpcAppOptions

type GrpcAppOptions struct {
	AppName   string
	Namespace string
}

type HTTPAppOptions

type HTTPAppOptions struct {
	Name                string
	Namespace           string // the object will be created in this namespace
	Port                int
	TargetPort          int
	MergeFromDeployment []*appsv1.Deployment
	MergeFromService    []*v1.Service
}

type ObjectAndWeight

type ObjectAndWeight struct {
	Object client.Object
	Weight int32
}

type RunGrpcurlCmdOptions

type RunGrpcurlCmdOptions struct {
	GrpcServerHostName  string
	GrpcServerPort      string
	Service             string
	Method              string
	Headers             [][2]string // a slice of string tuple
	ReqParamsJsonString string
	UseTLS              bool
}

type TestObject

type TestObject struct {
	Type     client.Object
	ListType client.ObjectList
}

Jump to

Keyboard shortcuts

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