Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteNS(c *kubernetes.Clientset, ns string) error
- func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)
- func IsOpenshift(client kubernetes.Interface) bool
- type Clients
- func (c *Clients) GetAaqClient() (*clientset.Clientset, error)
- func (c *Clients) GetCrClient() (crclient.Client, error)
- func (c *Clients) GetDynamicClient() (dynamic.Interface, error)
- func (c *Clients) GetKubeClient() (*kubernetes.Clientset, error)
- func (c *Clients) GetVirtClient() (*virtclientset.Clientset, error)
- func (c *Clients) LoadConfig() (*rest.Config, error)
- type Config
- type Framework
- func (f *Framework) AddNamespaceToDelete(ns *v1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CreateKubectlCommand(args ...string) *exec.Cmd
- func (f *Framework) CreateNamespace(prefix string, labels map[string]string) (*v1.Namespace, error)
- func (f *Framework) CreatePrometheusServiceInNs(namespace string) (*v1.Service, error)
- func (f *Framework) ExpectEvent(ns string) gomega.AsyncAssertion
- func (f *Framework) GetNodePlacementValuesWithRandomNodeAffinity(nodeSelectorTestValue map[string]string, tolerationTestValue []v1.Toleration) sdkapi.NodePlacement
- func (f *Framework) GetRESTConfig(namespace, name string) (*rest.Config, error)
- func (f *Framework) GetToken(namespace, name string) (string, error)
- func (f *Framework) PodSpecHasTestNodePlacementValues(podSpec v1.PodSpec, nodePlacement sdkapi.NodePlacement) error
- func (f *Framework) RunKubectlCommand(args ...string) (string, error)
- type KubernetesReporter
Constants ¶
const ( // PrometheusLabelKey provides the label to indicate prometheus metrics are available in the pods. PrometheusLabelKey = "prometheus.aaq.kubevirt.io" // PrometheusLabelValue provides the label value which shouldn't be empty to avoid a prometheus WIP issue. PrometheusLabelValue = "true" // HonorWaitForFirstConsumer - if enabled will not schedule worker pods on a storage with WaitForFirstConsumer binding mode HonorWaitForFirstConsumer = "HonorWaitForFirstConsumer" //NsPrefixLabel provides a aaq prefix label to identify the test namespace NsPrefixLabel = "aaq-e2e" )
Variables ¶
var (
ClientsInstance = &Clients{}
)
run-time flags
Functions ¶
func DeleteNS ¶
func DeleteNS(c *kubernetes.Clientset, ns string) error
DeleteNS provides a function to delete the specified namespace from the test cluster
func GetKubeClientFromRESTConfig ¶
func GetKubeClientFromRESTConfig(config *rest.Config) (*kubernetes.Clientset, error)
GetKubeClientFromRESTConfig provides a function to get a K8s client using hte REST config
func IsOpenshift ¶
func IsOpenshift(client kubernetes.Interface) bool
IsOpenshift checks if we are on OpenShift platform
Types ¶
type Clients ¶
type Clients struct { KubectlPath string OcPath string AAQInstallNs string KubeConfig string KubeURL string GoCLIPath string DockerPrefix string DockerTag string // k8sClient provides our k8s client pointer K8sClient *kubernetes.Clientset // AaqClient provides our AAQ client pointer AaqClient *aaqclientset.Clientset // CrClient is a controller runtime client CrClient crclient.Client // RestConfig provides a pointer to our REST client config. RestConfig *rest.Config // DynamicClient performs generic operations on arbitrary k8s API objects. DynamicClient dynamic.Interface }
Clients is the struct containing the client-go kubernetes clients
func (*Clients) GetAaqClient ¶
GetMtqClient gets an instance of a kubernetes client that includes all the MTQ extensions.
func (*Clients) GetCrClient ¶
GetCrClient returns a controller runtime client
func (*Clients) GetDynamicClient ¶
GetDynamicClient gets an instance of a dynamic client that performs generic operations on arbitrary k8s API objects.
func (*Clients) GetKubeClient ¶
func (c *Clients) GetKubeClient() (*kubernetes.Clientset, error)
GetKubeClient returns a Kubernetes rest client
func (*Clients) GetVirtClient ¶
func (c *Clients) GetVirtClient() (*virtclientset.Clientset, error)
type Config ¶
type Config struct { // SkipNamespaceCreation sets whether to skip creating a namespace. Use this ONLY for tests that do not require // a namespace at all, like basic sanity or other global tests. SkipNamespaceCreation bool // FeatureGates may be overridden for a framework FeatureGates []string }
Config provides some basic test config options
type Framework ¶
type Framework struct { Config // NsPrefix is a prefix for generated namespace NsPrefix string // Namespace provides a namespace for each test generated/unique ns per test Namespace *v1.Namespace *Clients // contains filtered or unexported fields }
Framework supports common operations used by functional/e2e tests. It holds the k8s and AAQ clients, a generated unique namespace, run-time flags, and more fields will be added over time as AAQ e2e evolves. Global BeforeEach and AfterEach are called in the Framework constructor.
func NewFramework ¶
NewFramework calls NewFramework and handles errors by calling Fail. Config is optional, but if passed there can only be one. To understand the order in which things are run, read http://onsi.github.io/ginkgo/#understanding-ginkgos-lifecycle flag parsing happens AFTER ginkgo has constructed the entire testing tree. So anything that uses information from flags cannot work when called during test tree construction.
func (*Framework) AddNamespaceToDelete ¶
AddNamespaceToDelete provides a wrapper around the go append function
func (*Framework) AfterEach ¶
func (f *Framework) AfterEach()
AfterEach provides a set of operations to run after each test
func (*Framework) BeforeEach ¶
func (f *Framework) BeforeEach()
BeforeEach provides a set of operations to run before each test
func (*Framework) CreateKubectlCommand ¶
CreateKubectlCommand returns the Cmd to execute kubectl
func (*Framework) CreateNamespace ¶
CreateNamespace instantiates a new namespace object with a unique name and the passed-in label(s).
func (*Framework) CreatePrometheusServiceInNs ¶
CreatePrometheusServiceInNs creates a service for prometheus in the specified namespace. This allows us to test for prometheus end points using the service to connect to the endpoints.
func (*Framework) ExpectEvent ¶
func (f *Framework) ExpectEvent(ns string) gomega.AsyncAssertion
ExpectEvent polls and fetches events during a defined period of time
func (*Framework) GetNodePlacementValuesWithRandomNodeAffinity ¶
func (f *Framework) GetNodePlacementValuesWithRandomNodeAffinity(nodeSelectorTestValue map[string]string, tolerationTestValue []v1.Toleration) sdkapi.NodePlacement
func (*Framework) GetRESTConfig ¶
GetRESTConfig returns a RESTConfig
func (*Framework) PodSpecHasTestNodePlacementValues ¶
func (f *Framework) PodSpecHasTestNodePlacementValues(podSpec v1.PodSpec, nodePlacement sdkapi.NodePlacement) error
PodSpecHasTestNodePlacementValues compares if the pod spec has the set of node placement values defined for testing purposes
type KubernetesReporter ¶
type KubernetesReporter struct { FailureCount int // contains filtered or unexported fields }
KubernetesReporter is the struct that holds the report info.
func NewKubernetesReporter ¶
func NewKubernetesReporter() *KubernetesReporter
NewKubernetesReporter creates a new instance of the reporter.
func (*KubernetesReporter) Cleanup ¶
func (r *KubernetesReporter) Cleanup()
Cleanup cleans up the current content of the artifactsDir
func (*KubernetesReporter) Dump ¶
func (r *KubernetesReporter) Dump(kubeCli *kubernetes.Clientset, since time.Duration)
Dump dumps the current state of the cluster. The relevant logs are collected starting from the since parameter.