framework

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeClusterRole

func MakeClusterRole(manifestPath string) (*v1.ClusterRole, error)

MakeClusterRole creates a cluster role object from yaml manifest.

func MakeClusterRoleBinding

func MakeClusterRoleBinding(manifestPath string) (*v1.ClusterRoleBinding, error)

MakeClusterRoleBinding creates a cluster role binding object from yaml manifest.

func MakeDeployment

func MakeDeployment(manifestPath string) (*appsv1.Deployment, error)

MakeDeployment creates a deployment object from yaml manifest.

func MakeServiceAccount

func MakeServiceAccount(manifestPath string) (*v1.ServiceAccount, error)

MakeServiceAccount creates a service account object from yaml manifest.

func NewBasicEvent

func NewBasicEvent() *v1.Event

NewBasicEvent constructs a basic Event for test purposes.

Types

type AssertEventsTotalFunc

type AssertEventsTotalFunc func(t *testing.T, exporter *KubeEventsExporter, event *v1.Event, count float64)

AssertEventsTotalFunc is a function that assert kube_events_total metrics.

type Framework

type Framework struct {
	KubeClient     kubernetes.Interface
	DefaultTimeout time.Duration
	ExporterImage  string
	ExporterArgs   []string
}

Framework contains global information needed by the framework helper functions.

func NewFramework

func NewFramework(kubeconfig, exporterImage string) (*Framework, error)

NewFramework returns a new framework.

func (*Framework) AssertEventsTotalAbsent

func (f *Framework) AssertEventsTotalAbsent(t *testing.T, exporter *KubeEventsExporter, event *v1.Event, count float64)

AssertEventsTotalAbsent asserts that the kube_events_total metric related to the given event and count is absent on the exporter.

func (*Framework) AssertEventsTotalPresent

func (f *Framework) AssertEventsTotalPresent(t *testing.T, exporter *KubeEventsExporter, event *v1.Event, count float64)

AssertEventsTotalPresent asserts that the kube_events_total metric related to the given event and count is present on the exporter.

func (*Framework) CreateBasicEvent

func (f *Framework) CreateBasicEvent(t *testing.T) *v1.Event

CreateBasicEvent creates a basic Event.

func (*Framework) CreateClusterRole

func (f *Framework) CreateClusterRole(t *testing.T, cr *v1.ClusterRole) *v1.ClusterRole

CreateClusterRole creates the given cluster role.

func (*Framework) CreateClusterRoleBinding

func (f *Framework) CreateClusterRoleBinding(t *testing.T, crb *v1.ClusterRoleBinding) *v1.ClusterRoleBinding

CreateClusterRoleBinding creates the given cluster role binding.

func (*Framework) CreateDeployment

func (f *Framework) CreateDeployment(t *testing.T, deployment *appsv1.Deployment, ns string) *appsv1.Deployment

CreateDeployment creates the given deployment.

func (*Framework) CreateEvent

func (f *Framework) CreateEvent(t *testing.T, event *v1.Event, ns string) *v1.Event

CreateEvent creates the given Event.

func (*Framework) CreateKubeEventsExporter

func (f *Framework) CreateKubeEventsExporter(t *testing.T) *KubeEventsExporter

CreateKubeEventsExporter creates kube-events-exporter deployment inside of the specified namespace.

func (*Framework) CreateService

func (f *Framework) CreateService(t *testing.T, service *v1.Service, ns string) *v1.Service

CreateService creates the given service.

func (*Framework) CreateServiceAccount

func (f *Framework) CreateServiceAccount(t *testing.T, sa *v1.ServiceAccount, ns string) *v1.ServiceAccount

CreateServiceAccount creates the given service account.

func (*Framework) DeleteClusterRole

func (f *Framework) DeleteClusterRole(name string) error

DeleteClusterRole deletes the given cluster role.

func (*Framework) DeleteClusterRoleBinding

func (f *Framework) DeleteClusterRoleBinding(name string) error

DeleteClusterRoleBinding deletes the given cluster role binding.

func (*Framework) DeleteDeployment

func (f *Framework) DeleteDeployment(ns, name string) error

DeleteDeployment deletes the given deployment.

func (*Framework) DeleteEvent

func (f *Framework) DeleteEvent(ns, name string) error

DeleteEvent deletes the given Event.

func (*Framework) DeleteService

func (f *Framework) DeleteService(ns, name string) error

DeleteService deletes the given service.

func (*Framework) DeleteServiceAccount

func (f *Framework) DeleteServiceAccount(ns, name string) error

DeleteServiceAccount deletes the given service account.

func (*Framework) NewEventsEventRecorder

func (f *Framework) NewEventsEventRecorder(stopCh <-chan struct{}) events.EventRecorder

NewEventsEventRecorder constructs an events.EventRecorder.

func (*Framework) NewRecordEventRecorder

func (f *Framework) NewRecordEventRecorder() record.EventRecorder

NewRecordEventRecorder constructs a record.EventRecorder.

func (*Framework) PollMetric

func (f *Framework) PollMetric(getter metricFamiliesGetter, name string, expectedMetric *dto.Metric) error

PollMetric tries to find the given metric in the metric families returned by the provided getter until the framework default timeout.

func (*Framework) UpdateEvent

func (f *Framework) UpdateEvent(event *v1.Event, ns string) (*v1.Event, error)

UpdateEvent updates the given Event.

type KubeEventsExporter

type KubeEventsExporter struct {
	EventServerURL    string
	ExporterServerURL string
	// contains filtered or unexported fields
}

KubeEventsExporter exposes information needed by the framework to interact with kube-events-exporter.

func (*KubeEventsExporter) GetEventMetricFamilies

func (e *KubeEventsExporter) GetEventMetricFamilies() (map[string]*dto.MetricFamily, error)

GetEventMetricFamilies gets metrics from the event server metrics endpoint and converts them to Prometheus MetricFamily.

func (*KubeEventsExporter) GetExporterMetricFamilies

func (e *KubeEventsExporter) GetExporterMetricFamilies() (map[string]*dto.MetricFamily, error)

GetExporterMetricFamilies gets metrics from the exporter server metrics endpoint and converts them to Prometheus MetricFamily.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL