Skip to content

Latest commit

 

History

History
111 lines (84 loc) · 3.71 KB

README.md

File metadata and controls

111 lines (84 loc) · 3.71 KB

Fluent-bit integration tests

This repository contains integration tests to assert that fluent-bit is able to talk reliably with external service providers required by the plugins.

Integration tests, validates that the full data pipeline works (input->filter->output) for a given set of plugins and configuration options for fluent-bit and isn't intended to cover end to end nor load testing.

Running the suite

For running the testing suite locally, some dependencies are required in the system.

Run the full suite.

./run-tests.sh

Run a specific test.

./run-tests.sh tests/opensearch/basic.bats

Set up

The tests require a Kubernetes cluster to run, typically you can create this locally with KIND:

kind create cluster --config tests/kind.yaml

This creates a local cluster called kind with your kubeconfig file all set up to use it. Make sure to use the configuration file so we create multiple nodes otherwise you will get failures to schedule pods due to affinity rules.

To load images into the cluster, for example if they cannot be pulled from a registry: https://kind.sigs.k8s.io/docs/user/quick-start/#loading-an-image-into-your-cluster

kind load docker-image <image name>

Note that an image in your local container runtime cache is not available to KIND unless you make it available like this.

OpenSearch requires the following: https://opensearch.org/docs/2.1/opensearch/install/important-settings/

Variables

The following is the list of environment variables that controls the behavior of running the test suites:

SKIP_TEARDOWN=yes # don't remove the testing namespace(s)
TEST_NAMESPACE=test # k8s namespace to use, setting this env to any value forces tests to run in sequence
# HELM_VALUES_EXTRA_FILE is a default file containing global helm
# options that can be optionally applied on helm install/upgrade
# by the test. This will fall back to $TEST_ROOT/defaults/values.yaml.tpl
# if not passed.
HELM_VALUES_EXTRA_FILE=./path/to/your/default/values.yaml
# The BATS formatter to use: https://bats-core.readthedocs.io/en/stable/usage.html
BATS_FORMATTER=tap
#BATS_JOBS_PARAMS (default below) will run 8 tests in parallel,
# this can be disabled by changing this variable OR by setting a TEST_NAMESPACE env
# which will force jobs to run in sequence
BATS_JOBS_PARAMS="--jobs 8 --no-parallelize-within-files"
# The Fluent Bit image to use
FLUENTBIT_IMAGE_REPOSITORY=ghcr.io/fluent/fluent-bit
FLUENTBIT_IMAGE_TAG=latest
# Elasticsearch image to use:
ELASTICSEARCH_IMAGE_REPOSITORY=elasticsearch
ELASTICSEARCH_IMAGE_TAG=7.17.3
# Opensearch image to use:
OPENSEARCH_IMAGE_REPOSITORY=opensearchproject/opensearch
OPENSEARCH_IMAGE_TAG=1.3.0
# Configuration options for Opensearch:
HOSTED_OPENSEARCH_HOST="localhost"
HOSTED_OPENSEARCH_PORT="443"
HOSTED_OPENSEARCH_USERNAME="admin"
HOSTED_OPENSEARCH_PASSWORD="admin"

For other options check run-tests.sh

Adding a new test suite

  1. Name the test under tests/ as the service/plugin name, (i.e. tests/opensearch).
  2. Resources that belongs to helm or kubernetes (such as manifests or helm file values) should go under resources/.

As an example

tests/opensearch
├── basic.bats
└── resources
    ├── helm
    │   ├── fluentbit-basic.yaml
    │   └── opensearch-basic.yaml
    └── k8s
        └── service.yaml

Performance tests and automated monitoring

See the PERFORMANCE-TESTS documentation for full details.