e2e

package
v0.0.0-...-c6c896d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InfraIndexPrefix   = "infra-"
	ProjectIndexPrefix = "app-"
	AuditIndexPrefix   = "audit-"
)
View Source
const (
	DefaultCleanUpTimeout = 60.0 * 5

	DefaultWaitForLogsTimeout = 5 * time.Minute
)
View Source
const (
	SplunkStandalone = "splunk-standalone"
	Splunk           = "splunk"

	SplunkHecService = "splunk-hec-service"
)
View Source
const (
	SyslogReceiverName = "syslog-receiver"
	ImageRemoteSyslog  = "registry.redhat.io/rhel8/rsyslog:8.7-9"
)
View Source
const (
	TcpSyslogInput = `` /* 191-byte string literal not displayed */

	TcpSyslogInputWithTLS = `` /* 597-byte string literal not displayed */

	UdpSyslogInput = `` /* 191-byte string literal not displayed */

	UdpSyslogInputWithTLS = `` /* 626-byte string literal not displayed */

	RuleSetRfc5424 = `` /* 159-byte string literal not displayed */

	RuleSetRfc3164 = `` /* 159-byte string literal not displayed */

	// includes both rfc parsers
	RuleSetRfc3164Rfc5424 = `` /* 177-byte string literal not displayed */

)
View Source
const (
	HttpReceiver = "http-receiver"
)
View Source
const (
	UnsecureFluentConf = `` /* 575-byte string literal not displayed */

)

Variables

View Source
var (
	HecToken      = rand.Word(16)
	AdminPassword = rand.Word(16)

	SplunkEndpoint = url.URL{
		Scheme: "http",
		Host:   fmt.Sprintf("%s:%d", SplunkHecService, splunkHecPort),
	}
)

Functions

func DoCleanup

func DoCleanup() bool

func GenerateRsyslogConf

func GenerateRsyslogConf(conf string, rfc SyslogRfc) string

func NewKubeClient

func NewKubeClient() (*kubernetes.Clientset, *rest.Config)

NewKubeClient returns a client using the KUBECONFIG env var or incluster settings

func RecreateClClfAsync

func RecreateClClfAsync(g *errgroup.Group, c *client.Test, cl *logging.ClusterLogging, clf *logging.ClusterLogForwarder)

CLF depends on CL, so sync the creator goroutines

func RunCleanupScript

func RunCleanupScript()

Types

type AuthorizationBuilder

type AuthorizationBuilder struct {
	// contains filtered or unexported fields
}

func (*AuthorizationBuilder) AllowClusterRole

func (b *AuthorizationBuilder) AllowClusterRole(roleName string) *AuthorizationBuilder

func (*AuthorizationBuilder) Create

func (b *AuthorizationBuilder) Create() (sa *corev1.ServiceAccount, err error)

type ContainerLogSimpleMeta

type ContainerLogSimpleMeta struct {
	Namespace     string
	PodName       string
	ContainerName string
}

func NewLogSimpleMeta

func NewLogSimpleMeta(parts []string) *ContainerLogSimpleMeta

type E2ETestFramework

type E2ETestFramework struct {
	RestConfig     *rest.Config
	KubeClient     *kubernetes.Clientset
	ClusterLogging *cl.ClusterLogging
	CleanupFns     []func() error
	LogStores      map[string]LogStore
}

func NewE2ETestFramework

func NewE2ETestFramework() *E2ETestFramework

func (*E2ETestFramework) AddCleanup

func (tc *E2ETestFramework) AddCleanup(fn func() error)

func (*E2ETestFramework) BuildAuthorizationFor

func (tc *E2ETestFramework) BuildAuthorizationFor(saNamespace, saName string) *AuthorizationBuilder

func (*E2ETestFramework) CleanFluentDBuffers

func (tc *E2ETestFramework) CleanFluentDBuffers()

func (*E2ETestFramework) Cleanup

func (tc *E2ETestFramework) Cleanup()

func (*E2ETestFramework) CreateClusterLogForwarder

func (tc *E2ETestFramework) CreateClusterLogForwarder(forwarder *logging.ClusterLogForwarder) error

func (*E2ETestFramework) CreateClusterLogging

func (tc *E2ETestFramework) CreateClusterLogging(clusterlogging *cl.ClusterLogging) error

func (*E2ETestFramework) CreateLegacySyslogConfigMap

func (tc *E2ETestFramework) CreateLegacySyslogConfigMap(namespace, conf string) (err error)

func (*E2ETestFramework) CreatePipelineSecret

func (tc *E2ETestFramework) CreatePipelineSecret(logStoreName, secretName string, otherData map[string][]byte) (*corev1.Secret, error)

func (*E2ETestFramework) CreateSyslogReceiverSecrets

func (tc *E2ETestFramework) CreateSyslogReceiverSecrets(testDir, logStoreName, secretName string) (secret *corev1.Secret, err error)

func (*E2ETestFramework) CreateTestNamespace

func (tc *E2ETestFramework) CreateTestNamespace() string

func (*E2ETestFramework) CreateTestNamespaceWithPrefix

func (tc *E2ETestFramework) CreateTestNamespaceWithPrefix(prefix string) string

func (*E2ETestFramework) DeployCURLLogGenerator

func (tc *E2ETestFramework) DeployCURLLogGenerator(endpoint string) (string, error)

func (*E2ETestFramework) DeployCURLLogGeneratorWithNamespaceAndEndpoint

func (tc *E2ETestFramework) DeployCURLLogGeneratorWithNamespaceAndEndpoint(namespace, endpoint string) error

func (*E2ETestFramework) DeployFluentdReceiver

func (tc *E2ETestFramework) DeployFluentdReceiver(rootDir string, secure bool) (deployment *apps.Deployment, err error)

func (*E2ETestFramework) DeployFluentdReceiverWithConf

func (tc *E2ETestFramework) DeployFluentdReceiverWithConf(rootDir string, secure bool, fluentConf string) (deployment *apps.Deployment, err error)

func (*E2ETestFramework) DeployHttpReceiver

func (tc *E2ETestFramework) DeployHttpReceiver(ns string) (deployment *VectorHttpReceiverLogStore, err error)

func (*E2ETestFramework) DeployJsonLogGenerator

func (tc *E2ETestFramework) DeployJsonLogGenerator(vals, labels map[string]string) (string, string, error)

func (*E2ETestFramework) DeployKafkaReceiver

func (tc *E2ETestFramework) DeployKafkaReceiver(topics []string) (*apps.StatefulSet, error)

func (*E2ETestFramework) DeployLogGenerator

func (tc *E2ETestFramework) DeployLogGenerator() (string, error)

func (*E2ETestFramework) DeployLogGeneratorWithNamespace

func (tc *E2ETestFramework) DeployLogGeneratorWithNamespace(namespace, name string, options LogGeneratorOptions) error

func (*E2ETestFramework) DeployLogGeneratorWithNamespaceName

func (tc *E2ETestFramework) DeployLogGeneratorWithNamespaceName(namespace, name string, options LogGeneratorOptions) error

func (*E2ETestFramework) DeploySplunk

func (tc *E2ETestFramework) DeploySplunk() (*apps.StatefulSet, error)

func (*E2ETestFramework) DeploySyslogReceiver

func (tc *E2ETestFramework) DeploySyslogReceiver(testDir string, protocol corev1.Protocol, withTLS bool, rfc SyslogRfc) (deployment *apps.Deployment, err error)

func (*E2ETestFramework) PodExec

func (tc *E2ETestFramework) PodExec(namespace, name, container string, command []string) (string, error)

func (*E2ETestFramework) SetupClusterLogging

func (tc *E2ETestFramework) SetupClusterLogging(componentTypes ...helpers.LogComponentType) (err error)

func (*E2ETestFramework) WaitFor

func (tc *E2ETestFramework) WaitFor(component helpers.LogComponentType) error

func (*E2ETestFramework) WaitForCleanupCompletion

func (tc *E2ETestFramework) WaitForCleanupCompletion(namespace string, podlabels []string)

func (*E2ETestFramework) WaitForDaemonSet

func (tc *E2ETestFramework) WaitForDaemonSet(namespace, name string) error

func (*E2ETestFramework) WaitForResourceCondition

func (tc *E2ETestFramework) WaitForResourceCondition(namespace, kind, name, selector, jsonPath string, maxtimes int, isSatisfied func(string) (bool, error)) error

WaitForResourceCondition retrieves resource info given a selector and evaluates the jsonPath output against the provided condition.

type ElasticLogStore

type ElasticLogStore struct {
	Framework *E2ETestFramework
}

func (*ElasticLogStore) ApplicationLogs

func (es *ElasticLogStore) ApplicationLogs(timeToWait time.Duration) (types.Logs, error)

func (*ElasticLogStore) ClusterLocalEndpoint

func (es *ElasticLogStore) ClusterLocalEndpoint() string

func (*ElasticLogStore) GrepLogs

func (es *ElasticLogStore) GrepLogs(expr string, timeToWait time.Duration) (string, error)

func (*ElasticLogStore) HasApplicationLogs

func (es *ElasticLogStore) HasApplicationLogs(timeToWait time.Duration) (bool, error)

func (*ElasticLogStore) HasAuditLogs

func (es *ElasticLogStore) HasAuditLogs(timeToWait time.Duration) (bool, error)

func (*ElasticLogStore) HasInfraStructureLogs

func (es *ElasticLogStore) HasInfraStructureLogs(timeToWait time.Duration) (bool, error)

func (*ElasticLogStore) Indices

func (es *ElasticLogStore) Indices() (Indices, error)

Indices fetches the list of indices stored by Elasticsearch

func (*ElasticLogStore) RetrieveLogs

func (es *ElasticLogStore) RetrieveLogs() (map[string]string, error)

type Index

type Index struct {
	Health           string `json:"health"`
	Status           string `json:"status"`
	Name             string `json:"index"`
	UUID             string `json:"uuid"`
	Primary          string `json:"pri"`
	Replicas         string `json:"rep"`
	DocsCount        string `json:"docs.count"`
	DocsDeleted      string `json:"docs.deleted"`
	StoreSize        string `json:"store.size"`
	PrimaryStoreSize string `json:"pri.store.size"`
}

func (*Index) DocCount

func (index *Index) DocCount() int

type Indices

type Indices []Index

func (*Indices) HasApplicationLogs

func (indices *Indices) HasApplicationLogs() bool

HasApplicationLogs returns true if there are any indices that begin with ProjectIndexPrefix and also contains documents

func (*Indices) HasAuditLogs

func (indices *Indices) HasAuditLogs() bool

HasAuditLogs returns true if there are any indices that begin with AuditIndexPrefix and also contains documents

func (*Indices) HasInfraStructureLogs

func (indices *Indices) HasInfraStructureLogs() bool

HasInfraStructureLogs returns true if there are any indices that begin with InfraIndexPrefix and also contains documents

type LogGeneratorOptions

type LogGeneratorOptions struct {
	Count          int
	Delay          time.Duration
	Message        string
	ContainerCount int
	Labels         map[string]string
}

func NewDefaultLogGeneratorOptions

func NewDefaultLogGeneratorOptions() LogGeneratorOptions

type LogStore

type LogStore interface {
	//ApplicationLogs returns app logs for a given log store
	ApplicationLogs(timeToWait time.Duration) (types.Logs, error)

	HasApplicationLogs(timeToWait time.Duration) (bool, error)

	HasInfraStructureLogs(timeToWait time.Duration) (bool, error)

	HasAuditLogs(timeToWait time.Duration) (bool, error)

	GrepLogs(expr string, timeToWait time.Duration) (string, error)

	RetrieveLogs() (map[string]string, error)

	ClusterLocalEndpoint() string
}

type Query

type Query struct {
	Meta []ContainerLogSimpleMeta
	// contains filtered or unexported fields
}

type SyslogRfc

type SyslogRfc int

SyslogRfc type is the rfc used for sending syslog

const (
	// RFC3164 rfc3164
	RFC3164 SyslogRfc = iota
	// RFC5424 rfc5424
	RFC5424
	// RFC3164RFC5424 either rfc3164 or rfc5424
	RFC3164RFC5424
)

func MustParseRFC

func MustParseRFC(rfc string) SyslogRfc

func (SyslogRfc) String

func (e SyslogRfc) String() string

type VectorHttpReceiverLogStore

type VectorHttpReceiverLogStore struct {
	*apps.Deployment
	// contains filtered or unexported fields
}

func (VectorHttpReceiverLogStore) ApplicationLogs

func (v VectorHttpReceiverLogStore) ApplicationLogs(timeToWait time.Duration) (types.Logs, error)

func (VectorHttpReceiverLogStore) ClusterLocalEndpoint

func (v VectorHttpReceiverLogStore) ClusterLocalEndpoint() string

func (VectorHttpReceiverLogStore) GrepLogs

func (v VectorHttpReceiverLogStore) GrepLogs(expr string, timeToWait time.Duration) (string, error)

func (VectorHttpReceiverLogStore) HasApplicationLogs

func (v VectorHttpReceiverLogStore) HasApplicationLogs(timeToWait time.Duration) (bool, error)

func (VectorHttpReceiverLogStore) HasAuditLogs

func (v VectorHttpReceiverLogStore) HasAuditLogs(timeToWait time.Duration) (bool, error)

func (VectorHttpReceiverLogStore) HasInfraStructureLogs

func (v VectorHttpReceiverLogStore) HasInfraStructureLogs(timeToWait time.Duration) (bool, error)

func (VectorHttpReceiverLogStore) ListContainers

func (v VectorHttpReceiverLogStore) ListContainers() (containers []string)

func (VectorHttpReceiverLogStore) ListJournalLogs

func (v VectorHttpReceiverLogStore) ListJournalLogs() ([]types.JournalLog, error)

func (VectorHttpReceiverLogStore) ListNamespaces

func (v VectorHttpReceiverLogStore) ListNamespaces() (namespaces []string)

func (VectorHttpReceiverLogStore) Query

func (v VectorHttpReceiverLogStore) Query(timeout *time.Duration) (*Query, error)

Query queries the receiver with a timeout for the request and returns a simple list of the meta available

func (VectorHttpReceiverLogStore) RetrieveLogs

func (v VectorHttpReceiverLogStore) RetrieveLogs() (map[string]string, error)

func (VectorHttpReceiverLogStore) RunCmd

func (v VectorHttpReceiverLogStore) RunCmd(cmd string, timeout *time.Duration) (string, error)

Jump to

Keyboard shortcuts

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