Documentation ¶
Index ¶
- Constants
- func BuildKubeConfig(t *testing.T) *restclient.Config
- func CreateKubeClient(t *testing.T) *kubernetes.Clientset
- func IsPlatformSupported(t *testing.T, platforms []Platform) bool
- func IsTestNamespace(name string) bool
- func IsUserNamespace(ns string) bool
- func Kubeconfig(t *testing.T) []byte
- func KubeconfigPath(t *testing.T) string
- func LokocfgPath(t *testing.T) string
- func PrintPodsLogs(t *testing.T, p corev1typed.PodInterface, selector *metav1.LabelSelector) error
- func TestNamespace(name string) string
- func WaitForDaemonSet(t *testing.T, client kubernetes.Interface, ns, name string, ...)
- func WaitForDeployment(t *testing.T, client kubernetes.Interface, ns, name string, ...)
- func WaitForPVCToBeBound(t *testing.T, client kubernetes.Interface, ns, name string, ...)
- func WaitForStatefulSet(t *testing.T, client kubernetes.Interface, ns, name string, replicas int, ...)
- type Platform
- type PortForwardInfo
Constants ¶
const ( // RetryInterval is time for test to retry. RetryInterval = time.Second * 5 // Timeout is time after which tests stops and fails. Timeout = time.Minute * 5 // TimeoutSlow is time after which tests stops and fails. TimeoutSlow = time.Minute * 9 )
const ( // PlatformAWS is for AWS PlatformAWS = "aws" // PlatformAWSEdge is for AWS with FCL Edge. PlatformAWSEdge = "aws_edge" // PlatformEquinixMetal is for Equinix Metal. PlatformEquinixMetal = "equinixmetal" // PlatformEquinixMetalARM is for Equinix Metal on ARM. PlatformEquinixMetalARM = "equinixmetal_arm" // PlatformBaremetal is for Baremetal PlatformBaremetal = "baremetal" // PlatformAKS is for AKS. PlatformAKS = "aks" )
const TestNamespacePrefix = "test-"
TestNamespacePrefix is testing namespace prefix.
Variables ¶
This section is empty.
Functions ¶
func BuildKubeConfig ¶ added in v0.8.0
func BuildKubeConfig(t *testing.T) *restclient.Config
BuildKubeConfig reads the environment variable KUBECONFIG and then builds the rest client config object which can be either used to create kube client to talk to apiserver or to just read the kubeconfig data.
func CreateKubeClient ¶
func CreateKubeClient(t *testing.T) *kubernetes.Clientset
CreateKubeClient returns a kubernetes client reading the KUBECONFIG environment variable.
func IsPlatformSupported ¶ added in v0.2.0
IsPlatformSupported takes in the test object and the list of supported platforms. The function detects the supported platform from environment variable. And if the platform is available in the supported platforms provided then this returns true otherwise false. If the supported platforms list is empty it is interpreted as all platforms are supported.
func IsTestNamespace ¶ added in v0.4.0
IsTestNamespace checks if namespace is a testing namespace or not.
func IsUserNamespace ¶ added in v0.4.0
IsUserNamespace checks for user namespace.
func Kubeconfig ¶ added in v0.4.0
Kubeconfig returns content of kubeconfig file defined with KUBECONFIG environment variable.
func KubeconfigPath ¶
func LokocfgPath ¶ added in v0.8.0
LokocfgPath gives the LOKOCFG_LOCATION value.
func PrintPodsLogs ¶ added in v0.4.0
func PrintPodsLogs(t *testing.T, p corev1typed.PodInterface, selector *metav1.LabelSelector) error
PrintPodsLogs print logs from all pods and containers selected by given selector.
func TestNamespace ¶ added in v0.4.0
TestNamespace creates a test namespace.
func WaitForDaemonSet ¶
func WaitForDeployment ¶
func WaitForPVCToBeBound ¶ added in v0.5.0
func WaitForPVCToBeBound( t *testing.T, client kubernetes.Interface, ns, name string, retryInterval, timeout time.Duration, )
WaitForPVCToBeBound is a helper utility function to test if given PVC reaches Bound phase in given time.
func WaitForStatefulSet ¶
Types ¶
type Platform ¶ added in v0.2.0
type Platform string
Platform is a type tests will use to specify which platform they are supported on.
type PortForwardInfo ¶ added in v0.1.0
type PortForwardInfo struct { // TODO: Add support providing service name and the API figures out the pod to forward the // connection to. Port forwarding works with pods only. PodName string Namespace string PodPort int LocalPort int // contains filtered or unexported fields }
PortForwardInfo allows user to provide information needed to forward port from a Kubernetes Pod to local machine.
func (*PortForwardInfo) CloseChan ¶ added in v0.1.0
func (p *PortForwardInfo) CloseChan()
CloseChan closes the stopChan which essentially disables port forwarding. User should call this method once they are done using port forwarding. This is generally called using `defer` immediately after `PortFoward`.
func (*PortForwardInfo) PortForward ¶ added in v0.1.0
func (p *PortForwardInfo) PortForward(t *testing.T)
PortForward initiates the port forward in an asynchronous mode. The user is responsible to stop port forwarding by calling `CloseChan` method on the object. Also user should use the helper method to wait until port forwarding is enabled by calling `WaitUntilForwardingAvailable`. So the user of the this method should always call this API in following sequence for correct functionality:
p.PortForward(t) defer p.CloseChan() p.WaitUntilForwardingAvailable(t)
func (*PortForwardInfo) WaitUntilForwardingAvailable ¶ added in v0.1.0
func (p *PortForwardInfo) WaitUntilForwardingAvailable(t *testing.T)
WaitUntilForwardingAvailable is a blocking call which waits until the port-forwarding is made available.