Documentation ¶
Index ¶
- Constants
- func ChangeMinMaxStatefulsetPods(app string, newMin uint64, newMax uint64) features.Func
- func GenerateLogs(implType logsGeneratorImplType, logsCount uint, logsGeneratorName string, ...) features.Func
- func GenerateTraces(tracesPerExporter uint, spansPerTrace uint, tracesGeneratorName string, ...) features.Func
- func HelmDeleteOpt(release string) features.Func
- func HelmDeleteTestOpt() features.Func
- func HelmDependencyUpdateOpt(path string) features.Func
- func HelmInstallOpt(path string, releaseName string) features.Func
- func HelmInstallTestOpt(path string) features.Func
- func HelmVersionOpt() features.Func
- func IntoTestEnvFunc(stepFn features.Func) internal.TestEnvFunc
- func IntoTestEnvFuncs(stepFns ...features.Func) []internal.TestEnvFunc
- func KubectlApplyFOpt(yamlPath string, namespace string) features.Func
- func KubectlCreateNamespaceOpt(namespace string) features.Func
- func KubectlCreateNamespaceTestOpt() features.Func
- func KubectlDeleteFOpt(yamlPath string, namespace string) features.Func
- func KubectlDeleteNamespaceOpt(namespace string) features.Func
- func KubectlDeleteNamespaceTestOpt() features.Func
- func PrintClusterStateOpt(force ...bool) features.Func
- func SetHelmOptionsOpt(valuesFilePath string, extraInstallationArgs map[string][]string) features.Func
- func SetHelmOptionsTestOpt(extraInstallationArgs []string) features.Func
- func Wait() features.Func
- func WaitForPvcCount(appName string, count int, waitDuration time.Duration, ...) features.Func
- func WaitUntilDaemonSetIsReady(waitDuration time.Duration, tickDuration time.Duration, opts ...Option) features.Func
- func WaitUntilDeploymentIsReady(waitDuration time.Duration, tickDuration time.Duration, opts ...Option) features.Func
- func WaitUntilExpectedLogsPresent(expectedLogsCount uint, expectedLogsMetadata map[string]string, ...) features.Func
- func WaitUntilExpectedMetricsPresent(expectedMetrics []string, receiverMockNamespace string, ...) features.Func
- func WaitUntilExpectedSpansPresent(expectedSpansCount uint, expectedSpansMetadata map[string]string, ...) features.Func
- func WaitUntilExpectedTracesPresent(expectedTracesCount uint, expectedSpansPerTraceCount uint, ...) features.Func
- func WaitUntilPodsAvailable(listOptions metav1.ListOptions, count int, wait time.Duration, ...) features.Func
- func WaitUntilStatefulSetIsReady(waitDuration time.Duration, tickDuration time.Duration, opts ...Option) features.Func
- type Formatter
- type LabelFormatterKV
- type Option
Constants ¶
const ( LogsGeneratorDeployment = iota LogsGeneratorDaemonSet )
Variables ¶
This section is empty.
Functions ¶
func GenerateLogs ¶
func GenerateLogs( implType logsGeneratorImplType, logsCount uint, logsGeneratorName string, logsGeneratorNamespace string, logsGeneratorImage string, ) features.Func
Generate logsCount logs using the designated implementation type: either deployment or a daemonset.
func GenerateTraces ¶
func GenerateTraces( tracesPerExporter uint, spansPerTrace uint, tracesGeneratorName string, tracesGeneratorNamespace string, tracesGeneratorImage string, ) features.Func
Generate logsCount logs using a deployment.
func HelmDeleteOpt ¶
HelmDeleteOpt returns a features.Func that with run helm delete using the provided release name as argument.
NOTE: By default the default cluster namespace will be used. If you'd like to specify the namespace use SetKubectlNamespaceOpt.
func HelmDeleteTestOpt ¶
HelmDeleteTestOpt wraps HelmDeleteOpt by taking the release name saved in context by HelmInstallTestOpt/HelmInstallOpt.
func HelmDependencyUpdateOpt ¶
HelmDependencyUpdateOpt returns a features.Func that will run helm dependency update using the provided path as an argument.
NOTE: This step will be skipped if the relevant environment variable (envNameHelmNoDependencyUpdate) will be set to a non empty value.
func HelmInstallOpt ¶
HelmInstallOpt returns a features.Func that with run helm install using the provided path and releaseName as arguments.
NOTE: By default the default cluster namespace will be used. If you'd like to specify the namespace use SetKubectlNamespaceOpt.
func HelmInstallTestOpt ¶
HelmInstallTestOpt wraps HelmInstallOpt with helm release name generation for tests.
func HelmVersionOpt ¶
HelmVersion returns a features.Func that will run helm version
func IntoTestEnvFunc ¶
func IntoTestEnvFunc(stepFn features.Func) internal.TestEnvFunc
func IntoTestEnvFuncs ¶
func IntoTestEnvFuncs(stepFns ...features.Func) []internal.TestEnvFunc
func KubectlApplyFOpt ¶
KubectlApplyFOpt returns a features.Func that will run "kubectl apply -f" in the provided namespace with the provided yaml file path as an argument.
func KubectlCreateNamespaceOpt ¶
KubectlCreateNamespaceOpt returns a features.Func that will create the requested namespace in the cluster and set it in kubectlOptions stored in the context.
func KubectlCreateNamespaceTestOpt ¶
KubectlCreateNamespaceTestOpt wraps KubectlCreateNamespaceOpt by generating a namespace name for test.
func KubectlDeleteFOpt ¶
KubectlDeleteFOpt returns a features.Func that will run "kubectl delete -f" in the provided namespace with the provided yaml file path as an argument.
func KubectlDeleteNamespaceOpt ¶
KubectlDeleteNamespaceOpt returns a features.Func that with delete the namespace that was saved in context using KubectlSetNamespaceOpt or KubectlSetTestNamespaceOpt.
func KubectlDeleteNamespaceTestOpt ¶
KubectlDeleteNamespaceTestOpt wraps KubectlDeleteNamespaceOpt by extracting the namespace saved in the context by KubectlCreateNamespaceTestOpt/KubectlCreateNamespaceOpt.
func PrintClusterStateOpt ¶
PrintClusterStateOpt returns a features.Func that will log the output of kubectl get all if the test has failed of if the optional force flag has been set.
NOTE: By default the default cluster namespace will be used. If you'd like to specify the namespace use SetKubectlNamespaceOpt.
func SetHelmOptionsOpt ¶
func SetHelmOptionsOpt(valuesFilePath string, extraInstallationArgs map[string][]string) features.Func
SetHelmOptionsOpt returns a features.Func that will get the kubectlOptions embedded in the context, use it to create helm options with values files set to the provided path.
NOTE: By default the default cluster namespace will be used. If you'd like to specify the namespace use SetKubectlNamespaceOpt.
func SetHelmOptionsTestOpt ¶
SetHelmOptionsTestOpt wraps SetHelmOptionsOpt by taking the values file from `values` directory and concatenating that with a name name generated from a test name.
The details of values file name generation can be found in `strings.ValueFileFromT()`.
func Wait ¶
Wait is a step func that will wait for an hour or until a SIGKILL or SIGINT will be received. It can be used as a helper func in order to inspect cluster state at a particular step.
func WaitForPvcCount ¶
func WaitUntilDaemonSetIsReady ¶
func WaitUntilDaemonSetIsReady( waitDuration time.Duration, tickDuration time.Duration, opts ...Option, ) features.Func
WaitUntilDaemonSetIsReady waits for a specified duration and checks with the specified tick interval whether the daemonset (as described by the provided options) is ready.
Readiness for a daemonset is defined as having Status.NumberUnavailable == 0.
func WaitUntilDeploymentIsReady ¶
func WaitUntilDeploymentIsReady( waitDuration time.Duration, tickDuration time.Duration, opts ...Option, ) features.Func
WaitUntilDeploymentIsReady waits for a specified duration and checks with the specified tick interval whether the deployment (as described by the provided options) is ready.
Readiness for a deployment is defined as having Status.NumberUnavailable == 0.
func WaitUntilExpectedLogsPresent ¶
func WaitUntilExpectedLogsPresent( expectedLogsCount uint, expectedLogsMetadata map[string]string, receiverMockNamespace string, receiverMockServiceName string, receiverMockServicePort int, waitDuration time.Duration, tickDuration time.Duration, ) features.Func
WaitUntilExpectedMetricsPresent returns a features.Func that can be used in `Assess` calls. It will wait until the provided number of logs with the provided labels are returned by receiver-mock's HTTP API on the provided Service and port, until it succeeds or waitDuration passes.
func WaitUntilExpectedMetricsPresent ¶
func WaitUntilExpectedMetricsPresent( expectedMetrics []string, receiverMockNamespace string, receiverMockServiceName string, receiverMockServicePort int, waitDuration time.Duration, tickDuration time.Duration, ) features.Func
WaitUntilExpectedMetricsPresent returns a features.Func that can be used in `Assess` calls. It will wait until all the provided metrics are returned by receiver-mock's HTTP API on the provided Service and port, until it succeeds or waitDuration passes.
func WaitUntilExpectedTracesPresent ¶
func WaitUntilExpectedTracesPresent( expectedTracesCount uint, expectedSpansPerTraceCount uint, expectedTracesMetadata map[string]string, receiverMockNamespace string, receiverMockServiceName string, receiverMockServicePort int, waitDuration time.Duration, tickDuration time.Duration, ) features.Func
func WaitUntilPodsAvailable ¶
func WaitUntilPodsAvailable(listOptions metav1.ListOptions, count int, wait time.Duration, tick time.Duration) features.Func
WaitUntilPodsAvailable returns a features.Func that can be used in `Assess` calls. It will wait until the selected pods are available, using the provided total `wait` and `tick` times as well as the provided list options and the desired count.
func WaitUntilStatefulSetIsReady ¶
func WaitUntilStatefulSetIsReady( waitDuration time.Duration, tickDuration time.Duration, opts ...Option, ) features.Func
WaitUntilStatefulSetIsReady waits for a specified duration and check with the specified tick interval whether the stateful set (as described by the provided options) is ready.
Readiness for a stateful set in here is defined as having N ready replicas where N is also equal to the spec replicas set on the stateful set.
Types ¶
type Formatter ¶
func ReleaseFormatter ¶
type LabelFormatterKV ¶
type Option ¶
type Option interface { Apply(ctx context.Context, obj k8s.Object) GetListOption(ctx context.Context) resources.ListOption }
Option is an interface that is used to pass in types that fulfill it to e.g. assess functions in internal/stepfuncs/assess_funcs.go so that their custom modification logic can be applied on k8s.Object.
Example:
func WaitUntilStatefulSetIsReady(
opts ...Option, ) features.Func { return func(ctx context.Context, t *testing.T, envConf *envconf.Config) context.Context { sts := appsv1.StatefulSet{ ObjectMeta: v1.ObjectMeta{ Namespace: ctxopts.Namespace(ctx), }, } for _, opt := range opts { opt.Apply(ctx, &sts) ... } ... }
func WithLabelsF ¶
func WithLabelsF(kvs ...LabelFormatterKV) Option
WithLabelsF creates an Option which can be used to set key value pairs with custom value formatting.
Example: stepfuncs.WaitUntilStatefulSetIsReady(
... stepfuncs.WithLabelsF( stepfuncs.LabelFormatterKV{ K: "app", V: stepfuncs.ReleaseFormatter("%s-sumologic-fluentd-events"), }, ),
),
The above snippet will use the helm release name (passed around in tests context) and place it in the `%s` format string when a test will be executed.