Documentation ¶
Index ¶
- Constants
- func OSMDescribe(name string, opts OSMDescribeInfo, body func()) bool
- type CleanupType
- type DataHandle
- func (sd *DataHandle) Iterate(f func())
- func (sd *DataHandle) IterateTrackedPods(f func(pod *corev1.Pod))
- func (sd *DataHandle) OutputIteration(iterNumber int, f *os.File)
- func (sd *DataHandle) OutputIterationTable(f *os.File)
- func (sd *DataHandle) OutputMemPerPod(f *os.File)
- func (sd *DataHandle) OutputTestResults(f *os.File)
- func (sd *DataHandle) WrapUp()
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigJSON
- type GRPCRequestDef
- type GRPCRequestResult
- type Grafana
- type GrafanaPanel
- type HTTPMultipleRequest
- type HTTPMultipleResults
- type HTTPRequestDef
- type HTTPRequestResult
- type InstallOSMOpts
- type InstallType
- type OSMDescribeInfo
- type OsmTestData
- func (td *OsmTestData) AddNsToMesh(shouldInjectSidecar bool, ns ...string) error
- func (td *OsmTestData) AreRegistryCredsPresent() bool
- func (td *OsmTestData) Cleanup(ct CleanupType)
- func (td *OsmTestData) CreateDeployment(ns string, deployment appsv1.Deployment) (*appsv1.Deployment, error)
- func (td *OsmTestData) CreateDockerRegistrySecret(ns string)
- func (td *OsmTestData) CreateHTTPRouteGroup(ns string, rg smiSpecs.HTTPRouteGroup) (*smiSpecs.HTTPRouteGroup, error)
- func (td *OsmTestData) CreateMultipleNs(nsName ...string) error
- func (td *OsmTestData) CreateMutatingWebhook(mwhc *v1beta1.MutatingWebhookConfiguration) (*v1beta1.MutatingWebhookConfiguration, error)
- func (td *OsmTestData) CreateNs(nsName string, labels map[string]string) error
- func (td *OsmTestData) CreatePod(ns string, pod corev1.Pod) (*corev1.Pod, error)
- func (td *OsmTestData) CreateService(ns string, svc corev1.Service) (*corev1.Service, error)
- func (td *OsmTestData) CreateServiceAccount(ns string, svcAccount *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
- func (td *OsmTestData) CreateSimpleAllowPolicy(def SimpleAllowPolicy) (smiSpecs.HTTPRouteGroup, smiAccess.TrafficTarget)
- func (td *OsmTestData) CreateSimpleTCPAllowPolicy(def SimpleAllowPolicy, port int) (smiSpecs.TCPRoute, smiAccess.TrafficTarget)
- func (td *OsmTestData) CreateSimpleTrafficSplit(def TrafficSplitDef) (smiSplit.TrafficSplit, error)
- func (td *OsmTestData) CreateTCPRoute(ns string, route smiSpecs.TCPRoute) (*smiSpecs.TCPRoute, error)
- func (td *OsmTestData) CreateTrafficSplit(ns string, tar smiSplit.TrafficSplit) (*smiSplit.TrafficSplit, error)
- func (td *OsmTestData) CreateTrafficTarget(ns string, tar smiAccess.TrafficTarget) (*smiAccess.TrafficTarget, error)
- func (td *OsmTestData) DeleteHelmRelease(name, namespace string) error
- func (td *OsmTestData) DeleteNs(nsName string) error
- func (td *OsmTestData) GRPCRequest(req GRPCRequestDef) GRPCRequestResult
- func (td *OsmTestData) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
- func (td *OsmTestData) GetGrafanaPodHandle(ns string, grafanaPodName string, port uint16) (*Grafana, error)
- func (td *OsmTestData) GetMutatingWebhook(mwhcName string) (*v1beta1.MutatingWebhookConfiguration, error)
- func (td *OsmTestData) GetOSMGrafanaHandle() (*Grafana, error)
- func (td *OsmTestData) GetOSMInstallOpts() InstallOSMOpts
- func (td *OsmTestData) GetOSMPrometheusHandle() (*Prometheus, error)
- func (td *OsmTestData) GetPodsForLabel(ns string, labelSel metav1.LabelSelector) ([]corev1.Pod, error)
- func (td *OsmTestData) GetPrometheusPodHandle(ns string, prometheusPodName string, port uint16) (*Prometheus, error)
- func (td *OsmTestData) GetTestFile(filename string) string
- func (td *OsmTestData) GetTestNamespaceSelectorMap() map[string]string
- func (td *OsmTestData) HTTPRequest(ht HTTPRequestDef) HTTPRequestResult
- func (td *OsmTestData) HelmInstallOSM(release, namespace string) error
- func (td *OsmTestData) InitSMIClients() error
- func (td *OsmTestData) InitTestData(t GinkgoTInterface) error
- func (td *OsmTestData) InstallOSM(instOpts InstallOSMOpts) error
- func (td *OsmTestData) LoadImagesToKind(imageNames []string) error
- func (td *OsmTestData) LoadOSMImagesIntoKind() error
- func (td *OsmTestData) MultipleHTTPRequest(requests *HTTPMultipleRequest) HTTPMultipleResults
- func (td *OsmTestData) PrettyPrintHTTPResults(results *HTTPMultipleResults)
- func (td *OsmTestData) RestartOSMController(instOpts InstallOSMOpts) error
- func (td *OsmTestData) RetryFuncOnError(f RetryOnErrorFunc, retryTimes int, sleepBetweenRetries time.Duration) error
- func (td *OsmTestData) RunLocal(path string, args []string) (*bytes.Buffer, *bytes.Buffer, error)
- func (td *OsmTestData) RunRemote(ns string, podName string, containerName string, command []string) (string, string, error)
- func (td *OsmTestData) SimpleDeploymentApp(def SimpleDeploymentAppDef) (corev1.ServiceAccount, appsv1.Deployment, corev1.Service)
- func (td *OsmTestData) SimplePodApp(def SimplePodAppDef) (corev1.ServiceAccount, corev1.Pod, corev1.Service)
- func (td *OsmTestData) TCPRequest(req TCPRequestDef) TCPRequestResult
- func (td *OsmTestData) UpdateOSMConfig(key, value string) error
- func (td *OsmTestData) VerifyComponentRestarts() (bool, error)
- func (td *OsmTestData) WaitForNamespacesDeleted(namespaces []string, timeout time.Duration) error
- func (td *OsmTestData) WaitForPodsRunningReady(ns string, timeout time.Duration, nExpectedRunningPods int) error
- func (td *OsmTestData) WaitForRepeatedSuccess(f SuccessFunction, minItForSuccess int, maxWaitTime time.Duration) bool
- type Prometheus
- func (p *Prometheus) GetCPULoadAvgforContainer(ns string, podName string, containerName string, period time.Duration, ...) (float64, error)
- func (p *Prometheus) GetCPULoadsForContainer(ns string, podName string, containerName string, t time.Time) (float64, float64, float64, error)
- func (p *Prometheus) GetMemRSSforContainer(ns string, podName string, containerName string, t time.Time) (float64, error)
- func (p *Prometheus) GetNumEnvoysInMesh(t time.Time) (int, error)
- func (p *Prometheus) Stop()
- func (p *Prometheus) VectorQuery(query string, t time.Time) (float64, error)
- type Resource
- type RetryOnErrorFunc
- type SimpleAllowPolicy
- type SimpleDeploymentAppDef
- type SimplePodAppDef
- type SuccessFunction
- type TCPRequestDef
- type TCPRequestResult
- type TrackedLabel
- type TrafficSplitBackend
- type TrafficSplitDef
Constants ¶
const ( // DefaultOsmGrafanaPort is the default Grafana port DefaultOsmGrafanaPort = 3000 // DefaultOsmPrometheusPort default OSM prometheus port DefaultOsmPrometheusPort = 7070 // OsmControllerAppLabel is the OSM Controller deployment app label OsmControllerAppLabel = "osm-controller" // OsmGrafanaAppLabel is the OSM Grafana deployment app label OsmGrafanaAppLabel = "osm-grafana" // OsmPrometheusAppLabel is the OSM Prometheus deployment app label OsmPrometheusAppLabel = "osm-prometheus" // MeshDetails is dashboard uuid and name as we have them load in Grafana MeshDetails string = "PLyKJcHGz/mesh-and-envoy-details" // MemRSSPanel is the ID of the MemRSS panel on OSM's MeshDetails dashboard MemRSSPanel int = 13 // CPUPanel is the ID of the CPU panel on OSM's MeshDetails dashboard CPUPanel int = 14 // AppProtocolHTTP is the HTTP application protocol AppProtocolHTTP = "http" // AppProtocolTCP is the TCP application protocol AppProtocolTCP = "tcp" )
const (
// StatusCodeWord is an identifier used on curl commands to print and parse REST Status codes
StatusCodeWord = "StatusCode"
)
Variables ¶
This section is empty.
Functions ¶
func OSMDescribe ¶
func OSMDescribe(name string, opts OSMDescribeInfo, body func()) bool
OSMDescribe givens the description of an e2e test
Types ¶
type CleanupType ¶
type CleanupType string
CleanupType identifies what triggered the cleanup
const ( // Test is to mark after-test cleanup Test CleanupType = "test" //Suite is to mark after-suite cleanup Suite CleanupType = "suite" )
type DataHandle ¶ added in v0.7.0
type DataHandle struct { // Test start time TestStartTime time.Time // Prometheus and Grafana handles PromHandle *Prometheus GrafHandle *Grafana // Result output files, allows setting multiple descriptors to write results ResultsOut []*os.File // Defines the resources to keep track across iterations TrackAppLabels []TrackedLabel // Defines the panels to save upon WrapUp invocation GrafanaPanelsToSave []GrafanaPanel // Set of names to track exact resources that were observed at any point in time // during the test SeenResources map[Resource]bool // Scale iterations data Iterations int ItStartTime []time.Time ItEndTime []time.Time }
DataHandle is the handle to specific resource information during a test
func NewDataHandle ¶ added in v0.7.0
func NewDataHandle(pHandle *Prometheus, gHandle *Grafana, trackResources []TrackedLabel, saveDashboards []GrafanaPanel) *DataHandle
NewDataHandle Returns an initialized scale data
func (*DataHandle) Iterate ¶ added in v0.7.0
func (sd *DataHandle) Iterate(f func())
Iterate wrapper to loop and track various resources across iterations (time, mem consumption, iteration num, etc.)
func (*DataHandle) IterateTrackedPods ¶ added in v0.7.0
func (sd *DataHandle) IterateTrackedPods(f func(pod *corev1.Pod))
IterateTrackedPods is a Helper to iterate pods selected by the Tracked labels
func (*DataHandle) OutputIteration ¶ added in v0.7.0
func (sd *DataHandle) OutputIteration(iterNumber int, f *os.File)
OutputIteration prints on file <f> the results of iteration <iterNumber> The CpuAvg is taken from the duration of the iteration itself, and uses prometheus `rate` which has extrapolation of both sides of the bucket. Mem RSS is simply the Mem RSS value at the end of the iteration.
func (*DataHandle) OutputIterationTable ¶ added in v0.7.0
func (sd *DataHandle) OutputIterationTable(f *os.File)
OutputIterationTable Print all iteration statistics in table format. For Duration and Memory values, relative distance to previous iteration is computed. For CPU, the CPU load average over the iteration time is computed (using prometheus rate).
func (*DataHandle) OutputMemPerPod ¶ added in v0.7.0
func (sd *DataHandle) OutputMemPerPod(f *os.File)
OutputMemPerPod outputs the per-pod mem delta for the tracked resources over the test and outputs it in table format, example: The output requires at least 2 iterations to compare, as the MemRSS initial value is taken from the end of the first iteration, to avoid counting overhead of the application itself.
func (*DataHandle) OutputTestResults ¶ added in v0.7.0
func (sd *DataHandle) OutputTestResults(f *os.File)
OutputTestResults Print all available results
func (*DataHandle) WrapUp ¶ added in v0.7.0
func (sd *DataHandle) WrapUp()
WrapUp is a callback to execute after the test is done. Will output all iteration results, compute some relative usages between iterations and save grafana dashboards if any are to be saved
type DockerConfig ¶
type DockerConfig map[string]DockerConfigEntry
DockerConfig and other configs are docker-specific container registry secret structures. Most of it is taken or referenced from kubectl source itself
type DockerConfigEntry ¶
type DockerConfigEntry struct { Username string `json:"username,omitempty"` Password string `json:"password,omitempty"` Email string `json:"email,omitempty"` Auth string `json:"auth,omitempty"` }
DockerConfigEntry is a struct for docker-specific container registry secret structures
type DockerConfigJSON ¶
type DockerConfigJSON struct { Auths DockerConfig `json:"auths"` HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` }
DockerConfigJSON is a struct for docker-specific config
type GRPCRequestDef ¶ added in v0.7.0
type GRPCRequestDef struct { // Source pod where to run the HTTP request from SourceNs string SourcePod string SourceContainer string // The entire destination URL processed by curl, including host name and // optionally protocol, port, and path Destination string // JSONRequest is the JSON request body JSONRequest string // Symbol is the fully qualified grpc service name, ex. hello.HelloService/SayHello Symbol string // UseTLS indicates if the request should be encrypted with TLS UseTLS bool }
GRPCRequestDef defines a remote GRPC request intent
type GRPCRequestResult ¶ added in v0.7.0
GRPCRequestResult represents the result of a GRPCRequest call
type Grafana ¶
type Grafana struct { Schema string Hostname string Port uint16 User string Password string // contains filtered or unexported fields }
Grafana is a simple handler to represent a target Grafana endpoint to run queries against
func (*Grafana) PanelPNGSnapshot ¶
func (g *Grafana) PanelPNGSnapshot(dashboard string, panelID int, fromMinutes int, saveFilepath string) error
PanelPNGSnapshot takes a snapshot from a Grafana dashboard or panel and saves it in local in <filename> in png format, using it's remote rendering HTTP API.
type GrafanaPanel ¶ added in v0.7.0
GrafanaPanel identifies a target Panel to be saved at the end of the test
type HTTPMultipleRequest ¶
type HTTPMultipleRequest struct { // Request Sources []HTTPRequestDef }
HTTPMultipleRequest takes multiple HTTP request defs to issue them concurrently
type HTTPMultipleResults ¶
type HTTPMultipleResults map[string]map[string]HTTPRequestResult
HTTPMultipleResults represents results from a multiple HTTP request call results come back as a map["srcNs/srcPod"]["dstNs/dstPod"] -> HTTPResults
type HTTPRequestDef ¶
type HTTPRequestDef struct { // Source pod where to run the HTTP request from SourceNs string SourcePod string SourceContainer string // The entire destination URL processed by curl, including host name and // optionally protocol, port, and path Destination string }
HTTPRequestDef defines a remote HTTP request intent
type HTTPRequestResult ¶
HTTPRequestResult represents results of an HTTPRequest call
type InstallOSMOpts ¶
type InstallOSMOpts struct { ControlPlaneNS string CertManager string ContainerRegistryLoc string ContainerRegistrySecret string OsmImagetag string DeployGrafana bool DeployPrometheus bool DeployJaeger bool DeployFluentbit bool VaultHost string VaultProtocol string VaultToken string VaultRole string CertmanagerIssuerGroup string CertmanagerIssuerKind string CertmanagerIssuerName string EgressEnabled bool EnablePermissiveMode bool EnvoyLogLevel string EnableDebugServer bool SetOverrides []string }
InstallOSMOpts describes install options for OSM
type InstallType ¶
type InstallType string
InstallType defines several OSM test deployment scenarios
const ( // SelfInstall uses current kube cluster, installs OSM using CLI SelfInstall InstallType = "SelfInstall" // KindCluster Creates Kind cluster on docker and uses it as cluster, OSM installs through CLI KindCluster InstallType = "KindCluster" // NoInstall uses current kube cluster, assumes an OSM is present in `OsmNamespace` NoInstall InstallType = "NoInstall" )
type OSMDescribeInfo ¶
type OSMDescribeInfo struct { // Tier represents the priority of the test. Lower value indicates higher priority. Tier int // Bucket indicates in which test Bucket the test will run in for CI. Each // Bucket is run in parallel while tests in the same Bucket run sequentially. Bucket int }
OSMDescribeInfo is a struct to represent the Tier and Bucket of a given e2e test
func (OSMDescribeInfo) String ¶
func (o OSMDescribeInfo) String() string
type OsmTestData ¶
type OsmTestData struct { T GinkgoTInterface // for common test logging TestID uint64 // uint randomized for every test. GinkgoRandomSeed can't be used as is per-suite. TestFolderName string // Test folder name, when overridden by test flags CleanupTest bool // Cleanup test-related resources once finished WaitForCleanup bool // Forces test to wait for effective deletion of resources upon cleanup IgnoreRestarts bool // Ignore control plane processes restarts, if any // OSM install-time variables InstType InstallType // Install type. OsmNamespace string OsmImageTag string EnableNsMetricTag bool // Container registry related vars CtrRegistryUser string // registry login CtrRegistryPassword string // registry password, if any CtrRegistryServer string // server name. Has to be network reachable // Kind cluster related vars ClusterName string // Kind cluster name (used if kindCluster) CleanupKindClusterBetweenTests bool // Clean and re-create kind cluster between tests CleanupKindCluster bool // Cleanup kind cluster upon test finish // Cluster handles and rest config Env *cli.EnvSettings RestConfig *rest.Config Client *kubernetes.Clientset SmiClients *smiClients ClusterProvider *cluster.Provider // provider, used when kindCluster is used }
OsmTestData stores common state, variables and flags for the test at hand
var Td OsmTestData
Td the global context for test.
func (*OsmTestData) AddNsToMesh ¶
func (td *OsmTestData) AddNsToMesh(shouldInjectSidecar bool, ns ...string) error
AddNsToMesh Adds monitored namespaces to the OSM mesh
func (*OsmTestData) AreRegistryCredsPresent ¶
func (td *OsmTestData) AreRegistryCredsPresent() bool
AreRegistryCredsPresent checks if Registry Credentials are present It's usually used to factor if a docker registry secret and ImagePullSecret should be installed when creating namespaces and application templates
func (*OsmTestData) Cleanup ¶
func (td *OsmTestData) Cleanup(ct CleanupType)
Cleanup is Used to cleanup resources once the test is done
func (*OsmTestData) CreateDeployment ¶
func (td *OsmTestData) CreateDeployment(ns string, deployment appsv1.Deployment) (*appsv1.Deployment, error)
CreateDeployment is a wrapper to create a deployment
func (*OsmTestData) CreateDockerRegistrySecret ¶
func (td *OsmTestData) CreateDockerRegistrySecret(ns string)
CreateDockerRegistrySecret creates a secret named `registrySecretName` in namespace <ns>, based on ctrRegistry variables
func (*OsmTestData) CreateHTTPRouteGroup ¶
func (td *OsmTestData) CreateHTTPRouteGroup(ns string, rg smiSpecs.HTTPRouteGroup) (*smiSpecs.HTTPRouteGroup, error)
CreateHTTPRouteGroup Creates an SMI HTTPRouteGroup
func (*OsmTestData) CreateMultipleNs ¶
func (td *OsmTestData) CreateMultipleNs(nsName ...string) error
CreateMultipleNs simple CreateNs for multiple NS creation
func (*OsmTestData) CreateMutatingWebhook ¶
func (td *OsmTestData) CreateMutatingWebhook(mwhc *v1beta1.MutatingWebhookConfiguration) (*v1beta1.MutatingWebhookConfiguration, error)
CreateMutatingWebhook is a wrapper to create a mutating webhook configuration
func (*OsmTestData) CreateNs ¶
func (td *OsmTestData) CreateNs(nsName string, labels map[string]string) error
CreateNs creates a Namespace. Will automatically add Docker registry creds if provided
func (*OsmTestData) CreateService ¶
CreateService is a wrapper to create a service
func (*OsmTestData) CreateServiceAccount ¶
func (td *OsmTestData) CreateServiceAccount(ns string, svcAccount *corev1.ServiceAccount) (*corev1.ServiceAccount, error)
CreateServiceAccount is a wrapper to create a service account
func (*OsmTestData) CreateSimpleAllowPolicy ¶
func (td *OsmTestData) CreateSimpleAllowPolicy(def SimpleAllowPolicy) (smiSpecs.HTTPRouteGroup, smiAccess.TrafficTarget)
CreateSimpleAllowPolicy returns basic allow policy from source to destination, on a HTTP all-wildcard fashion
func (*OsmTestData) CreateSimpleTCPAllowPolicy ¶ added in v0.7.0
func (td *OsmTestData) CreateSimpleTCPAllowPolicy(def SimpleAllowPolicy, port int) (smiSpecs.TCPRoute, smiAccess.TrafficTarget)
CreateSimpleTCPAllowPolicy returns an allow policy to allow all TCP traffic from source to destination
func (*OsmTestData) CreateSimpleTrafficSplit ¶
func (td *OsmTestData) CreateSimpleTrafficSplit(def TrafficSplitDef) (smiSplit.TrafficSplit, error)
CreateSimpleTrafficSplit Creates an SMI TrafficTarget
func (*OsmTestData) CreateTCPRoute ¶ added in v0.7.0
func (td *OsmTestData) CreateTCPRoute(ns string, route smiSpecs.TCPRoute) (*smiSpecs.TCPRoute, error)
CreateTCPRoute Creates an SMI TCPRoute
func (*OsmTestData) CreateTrafficSplit ¶
func (td *OsmTestData) CreateTrafficSplit(ns string, tar smiSplit.TrafficSplit) (*smiSplit.TrafficSplit, error)
CreateTrafficSplit Creates an SMI TrafficSplit
func (*OsmTestData) CreateTrafficTarget ¶
func (td *OsmTestData) CreateTrafficTarget(ns string, tar smiAccess.TrafficTarget) (*smiAccess.TrafficTarget, error)
CreateTrafficTarget Creates an SMI TrafficTarget
func (*OsmTestData) DeleteHelmRelease ¶
func (td *OsmTestData) DeleteHelmRelease(name, namespace string) error
DeleteHelmRelease uninstalls a particular helm release
func (*OsmTestData) DeleteNs ¶
func (td *OsmTestData) DeleteNs(nsName string) error
DeleteNs deletes a test NS
func (*OsmTestData) GRPCRequest ¶ added in v0.7.0
func (td *OsmTestData) GRPCRequest(req GRPCRequestDef) GRPCRequestResult
GRPCRequest runs a GRPC request to run the GRPCRequestDef and return a GRPCRequestResult
func (*OsmTestData) GetConfigMap ¶
func (td *OsmTestData) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
GetConfigMap is a wrapper to get a config map by name in a particular namespace
func (*OsmTestData) GetGrafanaPodHandle ¶
func (td *OsmTestData) GetGrafanaPodHandle(ns string, grafanaPodName string, port uint16) (*Grafana, error)
GetGrafanaPodHandle generic func to forward a grafana pod and returns a handler pointing to the locally forwarded resource
func (*OsmTestData) GetMutatingWebhook ¶
func (td *OsmTestData) GetMutatingWebhook(mwhcName string) (*v1beta1.MutatingWebhookConfiguration, error)
GetMutatingWebhook is a wrapper to get a mutating webhook configuration
func (*OsmTestData) GetOSMGrafanaHandle ¶
func (td *OsmTestData) GetOSMGrafanaHandle() (*Grafana, error)
GetOSMGrafanaHandle convenience wrapper, will get the Grafana instance regularly deployed by OSM installation in test <OsmNamespace>
func (*OsmTestData) GetOSMInstallOpts ¶
func (td *OsmTestData) GetOSMInstallOpts() InstallOSMOpts
GetOSMInstallOpts initializes install options for OSM
func (*OsmTestData) GetOSMPrometheusHandle ¶ added in v0.7.0
func (td *OsmTestData) GetOSMPrometheusHandle() (*Prometheus, error)
GetOSMPrometheusHandle convenience wrapper, will get the Prometheus instance regularly deployed by OSM installation in test <OsmNamespace>
func (*OsmTestData) GetPodsForLabel ¶
func (td *OsmTestData) GetPodsForLabel(ns string, labelSel metav1.LabelSelector) ([]corev1.Pod, error)
GetPodsForLabel returns the Pods matching a specific `appLabel`
func (*OsmTestData) GetPrometheusPodHandle ¶
func (td *OsmTestData) GetPrometheusPodHandle(ns string, prometheusPodName string, port uint16) (*Prometheus, error)
GetPrometheusPodHandle generic func to forward a prometheus pod and returns a handler pointing to the locally forwarded resource
func (*OsmTestData) GetTestFile ¶
func (td *OsmTestData) GetTestFile(filename string) string
GetTestFile prefixes a filename with current test folder and creates the test folder for current test if it doesn't exists. Only if some part of a test calls this function the test folder will be created, otherwise nothing is created to avoid extra clutter.
func (*OsmTestData) GetTestNamespaceSelectorMap ¶
func (td *OsmTestData) GetTestNamespaceSelectorMap() map[string]string
GetTestNamespaceSelectorMap returns a string-based selector used to refer/select all namespace resources for this test
func (*OsmTestData) HTTPRequest ¶
func (td *OsmTestData) HTTPRequest(ht HTTPRequestDef) HTTPRequestResult
HTTPRequest runs a synchronous call to run the HTTPRequestDef and return a HTTPRequestResult
func (*OsmTestData) HelmInstallOSM ¶
func (td *OsmTestData) HelmInstallOSM(release, namespace string) error
HelmInstallOSM installs an osm control plane using the osm chart which lives in charts/osm
func (*OsmTestData) InitSMIClients ¶
func (td *OsmTestData) InitSMIClients() error
InitSMIClients initializes SMI clients on OsmTestData structure
func (*OsmTestData) InitTestData ¶
func (td *OsmTestData) InitTestData(t GinkgoTInterface) error
InitTestData Initializes the test structures Called by Gingkgo BeforeEach
func (*OsmTestData) InstallOSM ¶
func (td *OsmTestData) InstallOSM(instOpts InstallOSMOpts) error
InstallOSM installs OSM. The behavior of this function is dependant on installType and instOpts
func (*OsmTestData) LoadImagesToKind ¶ added in v0.7.0
func (td *OsmTestData) LoadImagesToKind(imageNames []string) error
LoadImagesToKind loads the list of images to the node for Kind clusters
func (*OsmTestData) LoadOSMImagesIntoKind ¶ added in v0.8.0
func (td *OsmTestData) LoadOSMImagesIntoKind() error
LoadOSMImagesIntoKind loads the OSM images to the node for Kind clusters
func (*OsmTestData) MultipleHTTPRequest ¶
func (td *OsmTestData) MultipleHTTPRequest(requests *HTTPMultipleRequest) HTTPMultipleResults
MultipleHTTPRequest will issue a list of requests concurrently and return results when all requests have returned
func (*OsmTestData) PrettyPrintHTTPResults ¶
func (td *OsmTestData) PrettyPrintHTTPResults(results *HTTPMultipleResults)
PrettyPrintHTTPResults prints pod results per namespace
func (*OsmTestData) RestartOSMController ¶ added in v0.7.0
func (td *OsmTestData) RestartOSMController(instOpts InstallOSMOpts) error
RestartOSMController restarts the osm-controller pod in the installed controller's namespace
func (*OsmTestData) RetryFuncOnError ¶ added in v0.8.0
func (td *OsmTestData) RetryFuncOnError(f RetryOnErrorFunc, retryTimes int, sleepBetweenRetries time.Duration) error
RetryFuncOnError runs the given function and retries for the given number of times if an error is encountered
func (*OsmTestData) RunRemote ¶
func (td *OsmTestData) RunRemote( ns string, podName string, containerName string, command []string) (string, string, error)
RunRemote runs command in remote container
func (*OsmTestData) SimpleDeploymentApp ¶
func (td *OsmTestData) SimpleDeploymentApp(def SimpleDeploymentAppDef) (corev1.ServiceAccount, appsv1.Deployment, corev1.Service)
SimpleDeploymentApp creates returns a set of k8s typed definitions for a deployment-based k8s definition. Includes Deployment, Service and ServiceAccount types
func (*OsmTestData) SimplePodApp ¶
func (td *OsmTestData) SimplePodApp(def SimplePodAppDef) (corev1.ServiceAccount, corev1.Pod, corev1.Service)
SimplePodApp creates returns a set of k8s typed definitions for a pod-based k8s definition. Includes Pod, Service and ServiceAccount types
func (*OsmTestData) TCPRequest ¶ added in v0.7.0
func (td *OsmTestData) TCPRequest(req TCPRequestDef) TCPRequestResult
TCPRequest runs a synchronous TCP request to run the TCPRequestDef and return a TCPRequestResult
func (*OsmTestData) UpdateOSMConfig ¶
func (td *OsmTestData) UpdateOSMConfig(key, value string) error
UpdateOSMConfig updates OSM configmap
func (*OsmTestData) VerifyComponentRestarts ¶ added in v0.8.0
func (td *OsmTestData) VerifyComponentRestarts() (bool, error)
VerifyComponentRestarts ensure no crashes on osm-namespace instances
func (*OsmTestData) WaitForNamespacesDeleted ¶
func (td *OsmTestData) WaitForNamespacesDeleted(namespaces []string, timeout time.Duration) error
WaitForNamespacesDeleted waits for the namespaces to be deleted. Reference impl taken from https://github.com/kubernetes/kubernetes/blob/master/test/e2e/framework/util.go#L258
func (*OsmTestData) WaitForPodsRunningReady ¶
func (td *OsmTestData) WaitForPodsRunningReady(ns string, timeout time.Duration, nExpectedRunningPods int) error
WaitForPodsRunningReady waits for a <n> number of pods on an NS to be running and ready
func (*OsmTestData) WaitForRepeatedSuccess ¶
func (td *OsmTestData) WaitForRepeatedSuccess(f SuccessFunction, minItForSuccess int, maxWaitTime time.Duration) bool
WaitForRepeatedSuccess runs and expects a certain result for a certain operation a set number of consecutive times over a set amount of time.
type Prometheus ¶
Prometheus is a simple handler to represent a target Prometheus endpoint to run queries against
func (*Prometheus) GetCPULoadAvgforContainer ¶
func (p *Prometheus) GetCPULoadAvgforContainer(ns string, podName string, containerName string, period time.Duration, t time.Time) (float64, error)
GetCPULoadAvgforContainer returns CPU load average for a period <duration> just before time <t>
func (*Prometheus) GetCPULoadsForContainer ¶
func (p *Prometheus) GetCPULoadsForContainer(ns string, podName string, containerName string, t time.Time) (float64, float64, float64, error)
GetCPULoadsForContainer convenience wrapper to get 1m, 5m and 15m cpu loads for a resource
func (*Prometheus) GetMemRSSforContainer ¶
func (p *Prometheus) GetMemRSSforContainer(ns string, podName string, containerName string, t time.Time) (float64, error)
GetMemRSSforContainer returns RSS memory footprint for a given NS/podname/containerName at a certain point in time
func (*Prometheus) GetNumEnvoysInMesh ¶
func (p *Prometheus) GetNumEnvoysInMesh(t time.Time) (int, error)
GetNumEnvoysInMesh Gets the Number of in-mesh pods (or envoys) in the mesh as seen by prometheus at a certain point in time.
func (*Prometheus) Stop ¶ added in v0.7.0
func (p *Prometheus) Stop()
Stop gracefully stops the port forwarding to Prometheus
func (*Prometheus) VectorQuery ¶
VectorQuery runs a query at time <t>, expects single vector type and single result. Returns expected first and only <SampleValue> as a float64 Returns 0 and err<Empty result from prometheus>, if no values are seen on prometheus (but query did succeed)
type RetryOnErrorFunc ¶ added in v0.8.0
type RetryOnErrorFunc func() error
RetryOnErrorFunc is a function type passed to RetryFuncOnError() to execute
type SimpleAllowPolicy ¶
type SimpleAllowPolicy struct { RouteGroupName string TrafficTargetName string SourceSVCAccountName string SourceNamespace string DestinationSvcAccountName string DestinationNamespace string }
SimpleAllowPolicy is a simplified struct to later get basic SMI allow policy
type SimpleDeploymentAppDef ¶
type SimpleDeploymentAppDef struct { Namespace string Name string Image string ReplicaCount int32 Command []string Args []string Ports []int AppProtocol string }
SimpleDeploymentAppDef defines some parametrization to create a deployment-based application from template
type SimplePodAppDef ¶
type SimplePodAppDef struct { Namespace string Name string Image string Command []string Args []string Ports []int AppProtocol string }
SimplePodAppDef defines some parametrization to create a pod-based application from template
type SuccessFunction ¶
type SuccessFunction func() bool
SuccessFunction is a simple definition for a success function. True as success, false otherwise
type TCPRequestDef ¶ added in v0.7.0
type TCPRequestDef struct { // Source pod where to run the HTTP request from SourceNs string SourcePod string SourceContainer string // The destination server host (FQDN or IP address) and port the request is directed to DestinationHost string DestinationPort int // Message to send as a part of the request Message string }
TCPRequestDef defines a remote TCP request intent
type TCPRequestResult ¶ added in v0.7.0
TCPRequestResult represents the result of a TCPRequest call
type TrackedLabel ¶ added in v0.7.0
type TrackedLabel struct { Namespace string Label metav1.LabelSelector }
TrackedLabel defines resources to track and monitor during the test
type TrafficSplitBackend ¶
TrafficSplitBackend is a simple define to refer to a TrafficSplit backend
type TrafficSplitDef ¶
type TrafficSplitDef struct { Name string Namespace string TrafficSplitServiceName string Backends []TrafficSplitBackend }
TrafficSplitDef is a simplified struct to get a TrafficSplit typed definition