Documentation
¶
Index ¶
- Constants
- Variables
- func DescribeTierN(tier uint) func(string, func()) bool
- type CleanupType
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigJSON
- type HTTPMultipleRequest
- type HTTPMultipleResults
- type HTTPRequestDef
- type HTTPRequestResult
- type InstallOSMOpts
- type InstallType
- type OsmTestData
- func (td *OsmTestData) AddNsToMesh(sidecardInject 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) 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) CreateSimpleTrafficSplit(def TrafficSplitDef) (smiSplit.TrafficSplit, 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) GetConfigMap(name, namespace string) (*corev1.ConfigMap, error)
- func (td *OsmTestData) GetOSMInstallOpts() InstallOSMOpts
- 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) MultipleHTTPRequest(requests *HTTPMultipleRequest) HTTPMultipleResults
- func (td *OsmTestData) PrettyPrintHTTPResults(results *HTTPMultipleResults)
- 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) UpdateOSMConfig(key, value string) 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 SimpleAllowPolicy
- type SimpleDeploymentAppDef
- type SimplePodAppDef
- type SuccessFunction
- type TrafficSplitBackend
- type TrafficSplitDef
Constants ¶
const (
// StatusCodeWord is an identifier used on curl commands to print and parse REST Status codes
StatusCodeWord = "StatusCode"
)
Variables ¶
var DescribeTier1 = DescribeTierN(1)
var DescribeTier2 = DescribeTierN(2)
Functions ¶
func DescribeTierN ¶ added in v0.5.0
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 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 DockerConfigJSON ¶
type DockerConfigJSON struct { Auths DockerConfig `json:"auths"` HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` }
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[namespace][pod] -> 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 {
// contains filtered or unexported fields
}
InstallOSMOpts describes install options for OSM
type InstallType ¶ added in v0.5.0
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 OsmTestData ¶
type OsmTestData struct { T GinkgoTInterface // for common test logging // contains filtered or unexported fields }
OsmTestData stores common state, variables and flags for the test at hand
func (*OsmTestData) AddNsToMesh ¶
func (td *OsmTestData) AddNsToMesh(sidecardInject 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 resorces 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 Route Group
func (*OsmTestData) CreateMultipleNs ¶
func (td *OsmTestData) CreateMultipleNs(nsName ...string) error
CreateMultipleNs simple CreateNs for multiple NS creation
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) CreateSimpleTrafficSplit ¶
func (td *OsmTestData) CreateSimpleTrafficSplit(def TrafficSplitDef) (smiSplit.TrafficSplit, error)
CreateSimpleTrafficSplit Creates an SMI TrafficTarget
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 ¶ added in v0.5.0
func (td *OsmTestData) DeleteHelmRelease(name, namespace string) error
func (*OsmTestData) DeleteNs ¶
func (td *OsmTestData) DeleteNs(nsName string) error
DeleteNs deletes a test NS
func (*OsmTestData) GetConfigMap ¶ added in v0.5.0
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) GetOSMInstallOpts ¶
func (td *OsmTestData) GetOSMInstallOpts() InstallOSMOpts
GetOSMInstallOpts initializes install options for OSM
func (*OsmTestData) GetTestNamespaceSelectorMap ¶ added in v0.5.0
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 ¶ added in v0.5.0
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) 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) 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) UpdateOSMConfig ¶ added in v0.5.0
func (td *OsmTestData) UpdateOSMConfig(key, value string) error
UpdateOSMConfig updates OSM configmap
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 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 {
// contains filtered or unexported fields
}
SimpleDeploymentAppDef defines some parametrization to create a deployment-based application from template
type SimplePodAppDef ¶
type SimplePodAppDef struct {
// contains filtered or unexported fields
}
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 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