Documentation ¶
Overview ¶
Package e2e contains supporting infrastructure for end-to-end integration testing driven by the tests in cmd/e2e-test.
Test should be written with a Sandbox:
func TestExample(t *testing.T) { for _, tc := range []struct{ ... }{ ... }{ tc := tc // avoid variable capture Framework.RunWithSandbox(t, func(t *testing.T, s *e2e.Sandbox) { t.Parallel() // Test code... }) } }
The Sandbox will handle resource isolation and reclaimation.
Index ¶
- Constants
- Variables
- func CheckDeletedNegCRs(s *Sandbox, negName, port string) (bool, error)
- func CheckDeployment(deployment *apps.Deployment) error
- func CheckDistinctResponseHost(vip string, expectDistinctHosts int, tolerateTransientError bool) error
- func CheckEchoServerResponse(vip string) (app.ResponseBody, error)
- func CheckForAnyFinalizer(ing *networkingv1.Ingress) error
- func CheckGCLB(gclb *fuzz.GCLB, numForwardingRules int, numBackendServices int) error
- func CheckNameInNegStatus(svc *v1.Service, expectedNegAttrs map[string]string) (annotations.NegStatus, error)
- func CheckNegCRs(svc *v1.Service, svcNegs *negv1beta1.ServiceNetworkEndpointGroupList, ...) error
- func CheckNegFinalizer(svcNeg negv1beta1.ServiceNetworkEndpointGroup) error
- func CheckNegOwnerRef(svc *v1.Service, svcNeg negv1beta1.ServiceNetworkEndpointGroup) error
- func CheckNegStatus(svc *v1.Service, expectSvcPors []string) (annotations.NegStatus, error)
- func CheckNegs(negs map[meta.Key]*fuzz.NetworkEndpoints, expectHealthy bool, expectCount int) error
- func CheckServiceAttachment(sa *fuzz.ServiceAttachment, cr *sav1.ServiceAttachment) (string, error)
- func CheckServiceAttachmentCRDeletion(s *Sandbox, saName string) bool
- func CheckServiceAttachmentFinalizer(cr *sav1.ServiceAttachment) error
- func CheckServiceAttachmentForwardingRule(s *Sandbox, c cloud.Cloud, cr *sav1.ServiceAttachment) error
- func CheckSvcEvents(s *Sandbox, svcName, msgType, message string, ignoreMessages ...string) (bool, error)
- func CheckV1Finalizer(ing *networkingv1.Ingress) error
- func CheckV2Finalizer(ing *networkingv1.Ingress) error
- func CreateEchoService(s *Sandbox, name string, annotations map[string]string) (*v1.Service, error)
- func CreateEchoServiceWithOS(s *Sandbox, name string, annotations map[string]string, os OS) (*v1.Service, error)
- func CreateILBSubnet(s *Sandbox) error
- func CreateNegCR(s *Sandbox, negName string, servicePort string) error
- func CreatePorterDeployment(s *Sandbox, name string, replics int32, version string) error
- func CreatePorterService(s *Sandbox, name string) error
- func CreateSecret(s *Sandbox, name string, data map[string][]byte) (*v1.Secret, error)
- func CreateSubnet(s *Sandbox, subnetName, purpose string) error
- func DeleteConfigMap(s *Sandbox, namespace, name string) error
- func DeleteDestinationRule(s *Sandbox, namespace, name string) error
- func DeleteGCPAddress(s *Sandbox, name string, region string) error
- func DeleteNegCR(s *Sandbox, negName string) error
- func DeleteSecret(s *Sandbox, name string) error
- func DeleteService(s *Sandbox, svcName string) error
- func DeleteServiceAttachment(s *Sandbox, saName string) error
- func DeleteSubnet(s *Sandbox, name string) error
- func EnsureConfigMap(s *Sandbox, namespace, name string, data map[string]string) error
- func EnsureEchoDeployment(s *Sandbox, name string, numReplicas int32, ...) error
- func EnsureEchoService(s *Sandbox, name string, annotations map[string]string, svcType v1.ServiceType, ...) (*v1.Service, error)
- func EnsureFrontendConfig(s *Sandbox, fc *frontendconfig.FrontendConfig) (*frontendconfig.FrontendConfig, error)
- func EnsureIngress(s *Sandbox, ing *networkingv1.Ingress) (*networkingv1.Ingress, error)
- func EnsurePorterDestinationRule(s *Sandbox, name, svcName string, versions []string) error
- func EnsureServiceAttachment(s *Sandbox, saName, svcName, subnetName string) (*sav1.ServiceAttachment, error)
- func GetConfigMap(s *Sandbox, namespace, name string) (map[string]string, error)
- func IsRfc1918Addr(addr string) bool
- func NewCloud(project, GceEndpointOverride string) (cloud.Cloud, error)
- func NewGCPAddress(s *Sandbox, name string, region string) error
- func NoopModify(*apps.Deployment)
- func SpreadPodAcrossZones(deployment *apps.Deployment)
- func Truncate(key string) string
- func UpgradeTestWaitForIngress(s *Sandbox, ing *networkingv1.Ingress, options *WaitForIngressOptions) (*networkingv1.Ingress, error)
- func WaitConfigMapEvents(s *Sandbox, namespace, name string, msgs []string, timeout time.Duration) error
- func WaitDestinationRuleAnnotation(s *Sandbox, namespace, name string, negCount int, timeout time.Duration) (*annotations.DestinationRuleNEGStatus, error)
- func WaitForDistinctHosts(ctx context.Context, vip string, expectDistinctHosts int, ...) error
- func WaitForEchoDeploymentStable(s *Sandbox, name string) error
- func WaitForFinalizer(s *Sandbox, ing *networkingv1.Ingress) (*networkingv1.Ingress, error)
- func WaitForFinalizerDeletion(ctx context.Context, g *fuzz.GCLB, s *Sandbox, ingName string, ...) error
- func WaitForFrontendResourceDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, ...) error
- func WaitForGCLBDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, ...) error
- func WaitForHTTPResourceAnnotations(s *Sandbox, ing *networkingv1.Ingress) (*networkingv1.Ingress, error)
- func WaitForIngress(s *Sandbox, ing *networkingv1.Ingress, ...) (*networkingv1.Ingress, error)
- func WaitForIngressDeletion(ctx context.Context, g *fuzz.GCLB, s *Sandbox, ing *networkingv1.Ingress, ...) error
- func WaitForNEGDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, ...) error
- func WaitForNegCRs(s *Sandbox, serviceName string, expectedNegs map[string]string) (annotations.NegStatus, error)
- func WaitForNegStatus(s *Sandbox, name string, expectSvcPorts []string, noPresentTest bool) (*annotations.NegStatus, error)
- func WaitForNegs(ctx context.Context, c cloud.Cloud, negName string, zones []string, ...) error
- func WaitForRedirectURLMapDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB) error
- func WaitForServiceAttachment(s *Sandbox, saName string) (string, error)
- func WaitForServiceAttachmentDeletion(s *Sandbox, saName, gceSAURL string) error
- func WaitForStandaloneNegDeletion(ctx context.Context, c cloud.Cloud, s *Sandbox, port string, ...) error
- func WaitForSvcNegErrorEvents(s *Sandbox, svcName string, possibleMessages []string) error
- func WhiteboxTest(ing *networkingv1.Ingress, fc *frontendconfigv1beta1.FrontendConfig, ...) (*fuzz.GCLB, error)
- type Cert
- type CertType
- type Framework
- type IngressStability
- type OS
- type Options
- type Sandbox
- type StatusManager
- type UpgradeTest
- type WaitForIngressOptions
Constants ¶
const ( ILBSubnetPurpose = "INTERNAL_HTTPS_LOAD_BALANCER" ILBSubnetName = "ilb-subnet-ingress-e2e" PSCSubnetPurpose = "PRIVATE_SERVICE_CONNECT" PSCSubnetName = "psc-nat-subnet" )
Variables ¶
var ErrSubnetExists = fmt.Errorf("ILB subnet in region already exists")
var Scheme = runtime.NewScheme()
Scheme is the default instance of runtime.Scheme to which types in the Kubernetes API are already registered. This is needed for ConfigMap search.
Functions ¶
func CheckDeletedNegCRs ¶ added in v1.10.0
CheckDeletedNegCRs verifies that the provided neg list does not have negs that are associated with the provided neg atrributes
func CheckDeployment ¶ added in v1.7.0
func CheckDeployment(deployment *apps.Deployment) error
CheckDeployment checks if the given deployment is in a stable state.
func CheckDistinctResponseHost ¶ added in v1.7.0
func CheckDistinctResponseHost(vip string, expectDistinctHosts int, tolerateTransientError bool) error
CheckDistinctResponseHost issue GET call to the vip for 100 times, parse the reponses and calculate the number of distinct backends.
func CheckEchoServerResponse ¶ added in v1.7.0
func CheckEchoServerResponse(vip string) (app.ResponseBody, error)
CheckEchoServerResponse issue a GET call to the vip and return the ResponseBody.
func CheckForAnyFinalizer ¶ added in v1.9.0
func CheckForAnyFinalizer(ing *networkingv1.Ingress) error
CheckForAnyFinalizer asserts that an ingress finalizer exists on Ingress.
func CheckNameInNegStatus ¶ added in v1.10.0
func CheckNameInNegStatus(svc *v1.Service, expectedNegAttrs map[string]string) (annotations.NegStatus, error)
CheckNameInNegStatus checks if the NEG Status annotation is present and in the expected state The parameter expectedNegAttrs will map a port to a neg name. If the the neg name is empty, CheckNameInNegStatus expects that the name is autogenerated and will check it
func CheckNegCRs ¶ added in v1.10.0
func CheckNegCRs(svc *v1.Service, svcNegs *negv1beta1.ServiceNetworkEndpointGroupList, expectedNegAttrs map[string]string) error
CheckNegCRs will check that the provided neg cr list have negs with the expected neg attributes
func CheckNegFinalizer ¶ added in v1.10.0
func CheckNegFinalizer(svcNeg negv1beta1.ServiceNetworkEndpointGroup) error
CheckNegFinalizer asserts that only the Neg finalizer exists on NEG CR.
func CheckNegOwnerRef ¶ added in v1.10.0
func CheckNegOwnerRef(svc *v1.Service, svcNeg negv1beta1.ServiceNetworkEndpointGroup) error
CheckNegOwnerRef verifies the owner reference on the provided neg cr point to the given service
func CheckNegStatus ¶ added in v1.7.0
CheckNegStatus checks if the NEG Status annotation is presented and in the expected state
func CheckNegs ¶ added in v1.7.0
CheckNegs checks if the network endpoints in the NEGs is in expected state
func CheckServiceAttachment ¶ added in v1.11.0
func CheckServiceAttachment(sa *fuzz.ServiceAttachment, cr *sav1.ServiceAttachment) (string, error)
CheckServiceAttachment verifes that the CR spec matches the GCE Service Attachment configuration and that the CR's Status was properly populated
func CheckServiceAttachmentCRDeletion ¶ added in v1.11.0
CheckServiceAttachmentCRDeletion verifes that the CR does not exist
func CheckServiceAttachmentFinalizer ¶ added in v1.11.0
func CheckServiceAttachmentFinalizer(cr *sav1.ServiceAttachment) error
CheckServiceAttachmentFinalizer verifes that the CR has the ServiceAttachment Finalizer
func CheckServiceAttachmentForwardingRule ¶ added in v1.11.0
func CheckServiceAttachmentForwardingRule(s *Sandbox, c cloud.Cloud, cr *sav1.ServiceAttachment) error
CheckServiceAttachmentForwardingRule verfies that the forwarding rule used in the GCE Service Attachment creation is the same one created by the Service referenced in the CR
func CheckSvcEvents ¶ added in v1.11.0
func CheckSvcEvents(s *Sandbox, svcName, msgType, message string, ignoreMessages ...string) (bool, error)
CheckSvcEvents checks to see if the service has an event with the provided msgType and message
func CheckV1Finalizer ¶ added in v1.9.0
func CheckV1Finalizer(ing *networkingv1.Ingress) error
CheckV1Finalizer asserts that only v1 finalizer exists on Ingress.
func CheckV2Finalizer ¶ added in v1.9.0
func CheckV2Finalizer(ing *networkingv1.Ingress) error
CheckV2Finalizer asserts that only v2 finalizer exists on Ingress.
func CreateEchoService ¶
CreateEchoService creates the pod and service serving echoheaders Todo: (shance) remove this and replace uses with EnsureEchoService()
func CreateEchoServiceWithOS ¶ added in v1.9.0
func CreateEchoServiceWithOS(s *Sandbox, name string, annotations map[string]string, os OS) (*v1.Service, error)
CreateEchoServiceWithOS creates the pod and service serving echoheaders Todo: (shance) remove this and replace uses with EnsureEchoService()
func CreateILBSubnet ¶ added in v1.8.0
CreateILBSubnet creates the ILB subnet
func CreateNegCR ¶ added in v1.10.0
CreateNegCR creates a neg cr with the provided neg name and service port. The neg cr created will not be a valid one and is expected to be GC'd by the controller
func CreatePorterDeployment ¶ added in v1.9.0
CreatePorterDeployment creates a Deployment with porter image.
func CreatePorterService ¶ added in v1.9.0
CreatePorterService creates a service that refers to Porter pods.
func CreateSecret ¶
CreateSecret creates a secret from the given data.
func CreateSubnet ¶ added in v1.11.0
CreateSubnet creates a subnet with the provided name and purpose
func DeleteConfigMap ¶ added in v1.9.0
DeleteConfigMap deletes the namespace:name ConfigMap
func DeleteDestinationRule ¶ added in v1.9.0
DeleteDestinationRule deletes the namespace:name DestinationRule.
func DeleteGCPAddress ¶ added in v1.6.0
DeleteGCPAddress deletes a global static IP address with the given name.
func DeleteNegCR ¶ added in v1.10.0
DeleteNegCR sends a deletion request for the neg cr with the provided negName in the sandbox's namespace
func DeleteSecret ¶ added in v1.6.0
DeleteSecret deletes a secret.
func DeleteService ¶ added in v1.17.0
DeleteService deletes the K8s service
func DeleteServiceAttachment ¶ added in v1.11.0
DeleteServiceAttachment ensures a ServiceAttachment resource
func DeleteSubnet ¶ added in v1.11.0
DeleteSubnet deletes the subnet
func EnsureConfigMap ¶ added in v1.9.0
EnsureConfigMap ensures the namespace:name ConfigMap Data fieled, create if the target not exist.
func EnsureEchoDeployment ¶ added in v1.7.0
func EnsureEchoDeployment(s *Sandbox, name string, numReplicas int32, modify func(deployment *apps.Deployment)) error
EnsureEchoDeployment ensures that the Echo deployment with the given description is set up
func EnsureEchoService ¶ added in v1.6.0
func EnsureEchoService(s *Sandbox, name string, annotations map[string]string, svcType v1.ServiceType, numReplicas int32) (*v1.Service, error)
EnsureEchoService that the Echo service with the given description is set up
func EnsureFrontendConfig ¶ added in v1.11.0
func EnsureFrontendConfig(s *Sandbox, fc *frontendconfig.FrontendConfig) (*frontendconfig.FrontendConfig, error)
TODO(shance) add frontendconfig CRUD
func EnsureIngress ¶ added in v1.6.0
func EnsureIngress(s *Sandbox, ing *networkingv1.Ingress) (*networkingv1.Ingress, error)
EnsureIngress creates a new Ingress or updates an existing one.
func EnsurePorterDestinationRule ¶ added in v1.9.0
EnsurePorterDestinationRule ensures the namespace:name DestinationRule.
func EnsureServiceAttachment ¶ added in v1.11.0
func EnsureServiceAttachment(s *Sandbox, saName, svcName, subnetName string) (*sav1.ServiceAttachment, error)
EnsureServiceAttachment ensures a ServiceAttachment resource
func GetConfigMap ¶ added in v1.9.0
GetConfigMap gets ConfigMap and returns the Data field.
func IsRfc1918Addr ¶ added in v1.7.0
IsRfc1918Addr returns true if the address supplied is an RFC1918 address
func NewGCPAddress ¶ added in v1.6.0
NewGCPAddress reserves a global static IP address with the given name.
func NoopModify ¶ added in v1.7.0
func NoopModify(*apps.Deployment)
NoopModify does not modify the input deployment
func SpreadPodAcrossZones ¶ added in v1.7.0
func SpreadPodAcrossZones(deployment *apps.Deployment)
SpreadPodAcrossZones sets pod anti affinity rules to try to spread pods across zones
func Truncate ¶ added in v1.11.0
Truncate truncates a gce resource name if it exceeds 62 chars This function is based on the one in pkg/namer/namer.go
func UpgradeTestWaitForIngress ¶ added in v1.9.0
func UpgradeTestWaitForIngress(s *Sandbox, ing *networkingv1.Ingress, options *WaitForIngressOptions) (*networkingv1.Ingress, error)
UpgradeTestWaitForIngress waits for ingress to stabilize and set sandbox status to stable. Note that this is used only for upgrade tests.
func WaitConfigMapEvents ¶ added in v1.9.0
func WaitConfigMapEvents(s *Sandbox, namespace, name string, msgs []string, timeout time.Duration) error
WaitConfigMapEvents waits the msgs messages present for namespace:name ConfigMap until timeout.
func WaitDestinationRuleAnnotation ¶ added in v1.9.0
func WaitDestinationRuleAnnotation(s *Sandbox, namespace, name string, negCount int, timeout time.Duration) (*annotations.DestinationRuleNEGStatus, error)
WaitDestinationRuleAnnotation waits until the DestinationRule NEG annotation count equal to negCount.
func WaitForDistinctHosts ¶ added in v1.7.0
func WaitForDistinctHosts(ctx context.Context, vip string, expectDistinctHosts int, tolerateTransientError bool) error
WaitForDistinctHosts waits util
func WaitForEchoDeploymentStable ¶ added in v1.7.0
WaitForEchoDeploymentStable waits until the deployment's readyReplicas, availableReplicas and updatedReplicas are equal to replicas.
func WaitForFinalizer ¶ added in v1.8.0
func WaitForFinalizer(s *Sandbox, ing *networkingv1.Ingress) (*networkingv1.Ingress, error)
WaitForFinalizer waits for Finalizer to be added. Note that this is used only for upgrade tests.
func WaitForFinalizerDeletion ¶ added in v1.7.0
func WaitForFinalizerDeletion(ctx context.Context, g *fuzz.GCLB, s *Sandbox, ingName string, options *fuzz.GCLBDeleteOptions) error
WaitForFinalizerDeletion waits for gclb resources to be deleted and the finalizer attached to the Ingress resource to be removed.
func WaitForFrontendResourceDeletion ¶ added in v1.9.0
func WaitForFrontendResourceDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, options *fuzz.GCLBDeleteOptions) error
WaitForFrontendResourceDeletion waits for frontend resources associated with the GLBC to be deleted for given protocol.
func WaitForGCLBDeletion ¶
func WaitForGCLBDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, options *fuzz.GCLBDeleteOptions) error
WaitForGCLBDeletion waits for the resources associated with the GLBC to be deleted.
func WaitForHTTPResourceAnnotations ¶ added in v1.9.0
func WaitForHTTPResourceAnnotations(s *Sandbox, ing *networkingv1.Ingress) (*networkingv1.Ingress, error)
WaitForHTTPResourceAnnotations waits for http forwarding rule annotation to be added on ingress. This is to handle a special case where ingress updates from https only to http or both http and https enabled. Turns out port 80 on ingress VIP is accessible even when http forwarding rule and target proxy do not exist. So, ingress validator thinks that http load balancer is configured when https only configuration exists. TODO(smatti): Remove this when the above issue is fixed.
func WaitForIngress ¶
func WaitForIngress(s *Sandbox, ing *networkingv1.Ingress, fc *frontendconfigv1beta1.FrontendConfig, options *WaitForIngressOptions) (*networkingv1.Ingress, error)
WaitForIngress to stabilize. We expect the ingress to be unreachable at first as LB is still programming itself (i.e 404's / 502's)
func WaitForIngressDeletion ¶
func WaitForIngressDeletion(ctx context.Context, g *fuzz.GCLB, s *Sandbox, ing *networkingv1.Ingress, options *fuzz.GCLBDeleteOptions) error
WaitForIngressDeletion deletes the given ingress and waits for the resources associated with it to be deleted.
func WaitForNEGDeletion ¶ added in v1.6.0
func WaitForNEGDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, options *fuzz.GCLBDeleteOptions) error
WaitForNEGDeletion waits for all NEGs associated with a GCLB to be deleted via GC
func WaitForNegCRs ¶ added in v1.10.0
func WaitForNegCRs(s *Sandbox, serviceName string, expectedNegs map[string]string) (annotations.NegStatus, error)
WaitForNegCRs waits up to the gclbDeletionTimeout for neg crs that have the configurations in expectedNegs, and are owned by the given service name, otherwise returns an error. The parameter expectedNegs maps a port to an expected neg name or an empty string for a generated name.
func WaitForNegStatus ¶ added in v1.7.0
func WaitForNegStatus(s *Sandbox, name string, expectSvcPorts []string, noPresentTest bool) (*annotations.NegStatus, error)
WaitForNegStatus waits util the neg status on the service got to expected state. if noPresentTest set to true, WaitForNegStatus makes sure no NEG annotation is added until timeout(5 mins).
func WaitForNegs ¶ added in v1.7.0
func WaitForNegs(ctx context.Context, c cloud.Cloud, negName string, zones []string, expectHealthy bool, expectCount int) error
WaitForNegs waits until the input NEG got into the expect states.
func WaitForRedirectURLMapDeletion ¶ added in v1.11.0
func WaitForServiceAttachment ¶ added in v1.11.0
WaitForServiceAttachment waits until the gce service attachment corresponding to the provided CR name is created and properly configured
func WaitForServiceAttachmentDeletion ¶ added in v1.11.0
WaitForServiceAttachmentDeletion waits until the Service Attachment CR and resource in GCE has been deleted.
func WaitForStandaloneNegDeletion ¶ added in v1.10.0
func WaitForStandaloneNegDeletion(ctx context.Context, c cloud.Cloud, s *Sandbox, port string, negStatus annotations.NegStatus) error
WaitForStandaloneNegDeletion waits for standalone NEGs and corresponding CR are deleted via GC.
func WaitForSvcNegErrorEvents ¶ added in v1.10.0
WaitForSvcNegErrorEvents waits for at least one of the possibles messages to be emitted on the namespace:svcName serice until timeout
func WhiteboxTest ¶ added in v1.9.0
func WhiteboxTest(ing *networkingv1.Ingress, fc *frontendconfigv1beta1.FrontendConfig, cloud cloud.Cloud, region string, s *Sandbox) (*fuzz.GCLB, error)
WhiteboxTest retrieves GCP load-balancer for Ingress VIP and runs the whitebox tests.
Types ¶
type Cert ¶ added in v1.6.0
type Cert struct { Host string Name string Type CertType // Regional represents if the cert should be created as regional or global // Not using composites here to avoid additional possible interference Regional bool // contains filtered or unexported fields }
Cert is a convenience type for representing an SSL certificate.
func NewCert ¶ added in v1.6.0
NewCert returns a cert initialized with data but not yet created in the appropriate environment.
type CertType ¶ added in v1.6.0
type CertType int
CertType indicates the intended environment in which this cert is created.
type Framework ¶
type Framework struct { RestConfig *rest.Config Clientset *kubernetes.Clientset DestinationRuleClient dynamic.NamespaceableResourceInterface BackendConfigClient *backendconfigclient.Clientset FrontendConfigClient *frontendconfigclient.Clientset SvcNegClient *svcnegclient.Clientset SAClient *adapter.ServiceAttachmentCRUD Project string Region string Network string Cloud cloud.Cloud Rand *rand.Rand CreateILBSubnet bool // contains filtered or unexported fields }
Framework is the end-to-end test framework.
func NewFramework ¶
NewFramework returns a new test framework to run.
func (*Framework) CatchSIGINT ¶
func (f *Framework) CatchSIGINT()
CatchSIGINT and cleanup sandboxes when the test is interrupted.
func (*Framework) RunWithSandbox ¶
RunWithSandbox runs the testFunc with the Sandbox, taking care of resource cleanup and isolation. This indirectly calls testing.T.Run().
func (*Framework) SanityCheck ¶
SanityCheck the test environment before proceeding.
type IngressStability ¶ added in v1.5.0
type IngressStability string
IngressStability denotes the stabilization status of all Ingresses in a sandbox.
var ( // Stable indicates an Ingress is stable (i.e consistently serving 200's) Stable IngressStability = "Stable" // Unstable indicates an Ingress is unstable (i.e serving 404/502's). Unstable IngressStability = "Unstable" )
type Options ¶
type Options struct { Project string Region string Network string Seed int64 DestroySandboxes bool GceEndpointOverride string CreateILBSubnet bool }
Options for the test framework.
type Sandbox ¶
type Sandbox struct { // Namespace to create resources in. Resources created in this namespace // will be deleted with Destroy(). Namespace string // ValidatorEnv for use with the test. ValidatorEnv fuzz.ValidatorEnv //Rand int that is used to generate the Namespace name RandInt int64 // contains filtered or unexported fields }
Sandbox represents a sandbox for running tests in a Kubernetes cluster.
func (*Sandbox) Destroy ¶
func (s *Sandbox) Destroy()
Destroy the sandbox and all resources associated with the sandbox.
func (*Sandbox) DumpSandboxInfo ¶ added in v1.7.0
DumpSandboxInfo dumps information about the sandbox into logs
func (*Sandbox) IstioEnabled ¶ added in v1.9.0
IstioEnabled returns true if Istio is enabled for target cluster.
func (*Sandbox) MasterUpgraded ¶ added in v1.5.0
MasterUpgraded checks the config map for whether or not the k8s master has successfully finished upgrading or not
func (*Sandbox) MasterUpgrading ¶ added in v1.5.0
MasterUpgrading checks the config map for whether or not the k8s master has successfully finished upgrading or not
func (*Sandbox) PutStatus ¶ added in v1.5.0
func (s *Sandbox) PutStatus(status IngressStability)
PutStatus into the status manager.
type StatusManager ¶ added in v1.5.0
type StatusManager struct {
// contains filtered or unexported fields
}
StatusManager manages the status of sandboxed Ingresses via a ConfigMap. It interacts with the an external framework test portion as follows: 1. StatusManager initializes and creates the ConfigMap status-cm. It listens on updates via informers. 2. e2e test calls StatusManager.putStatus with the Ingress name as key, and Unstable as the status 3. e2e test watches for when Ingress stabilizes, then uses StatusManager to update the Ingress's status to Stable 4. The external framework test reads from ConfigMap status-cm. When it detects that all Ingresses are stable (i.e., no value in the map is Unstable), it starts the MasterUpgrade. 5. When the k8s master finishes upgrading, the framework test writes the timestamp to the master-upgraded key in the ConfigMap 6. The external framework test writes the exit key in the ConfigMap to indicate that the e2e test can exit. 7. The StatusManager loop reads the exit key, then starts shutdown().
func NewStatusManager ¶ added in v1.5.0
func NewStatusManager(f *Framework) *StatusManager
NewStatusManager returns a new status manager.
type UpgradeTest ¶ added in v1.8.0
type UpgradeTest interface { // Name returns the name/description of the test. Name() string // Init initialized the Upgrade Test. Init(t *testing.T, s *Sandbox, framework *Framework) error // PreUpgrade runs before master upgrade. PreUpgrade() error // DuringUpgrade runs during master upgrade. DuringUpgrade() error // PostUpgrade runs after master upgrade. PostUpgrade() error }
UpgradeTest is an interface for writing generic upgrade test. TODO: add version compatibility into the interface
type WaitForIngressOptions ¶ added in v1.5.0
type WaitForIngressOptions struct { // ExpectUnreachable is true when we expect the LB to still be // programming itself (i.e 404's / 502's) ExpectUnreachable bool }
WaitForIngressOptions holds options dictating how we wait for an ingress to stabilize