Our goal is for the Observability team to execute this automated e2e test suite while developing the Helm charts for APM Server, Filebeat and Metricbeat. The tests in this folder assert that the use cases (or scenarios) defined in the features
directory are behaving as expected.
At the topmost level, the test framework uses a BDD framework written in Go, where we set the expected behavior of use cases in a feature file using Gherkin, and implementing the steps in Go code. The provisioning of services is accomplished using Kind (Kubernetes in Docker) and Helm packages.
The tests will follow this general high-level approach:
- Install runtime dependencies creating a Kind cluster using the locally installed
kind
binary, happening at before the test suite runs. - Execute BDD steps representing each scenario. Each step will return an Error if the behavior is not satisfied, marking the step and the scenario as failed, or will return
nil
.
-
Clone this repository, say into a folder named
e2e-testing
.git clone [email protected]:elastic/e2e-testing.git
-
Configure the version of the tools you want to test (Optional).
This is an example of the optional configuration:
# Depending on the versions used,
export HELM_VERSION="3.5.2" # Helm version: for Helm v2.x.x we have to initialise Tiller right after the k8s cluster
export HELM_CHART_VERSION="7.11.2" # version of the Elastic's Observability Helm charts
export KUBERNETES_VERSION="1.18.2" # version of the cluster to be passed to kind
-
Install dependencies.
- Install Helm 3.5.2
- Install Kind 0.10.0
- Install Go, using the language version defined in the
.go-version
file at the root directory. We recommend using GVM, same as done in the CI, which will allow you to install multiple versions of Go, setting the Go environment in consequence:eval "$(gvm 1.15.9)"
- Godog and other test-related binaries will be installed in their supported versions when the project is first built, thanks to Go modules and Go build system.
-
Run the tests.
If you want to run the tests in Developer mode, which means reusing bakend services between test runs, please set this environment variable first:
# It won't tear down the backend services (k8s cluster) after a test suite. export DEVELOPER_MODE=true
cd e2e/_suites/helm OP_LOG_LEVEL=DEBUG go test -v
Optionally, you can run only one of the feature files
cd e2e/_suites/helm OP_LOG_LEVEL=DEBUG go test -timeout 60m -v --godog.tags='@apm-server'
Sometimes the tests could fail to configure or start the kubernetes cluster, etc. To determine why this happened, look at your terminal log in DEBUG/TRACE mode. make sure there is not another test cluster:
# Will remove existing test cluster
kind delete cluster --name helm-charts-test-suite
Note what you find and file a bug in the elastic/e2e-testing
repository, requiring a fix to the helm suite to properly configure and start the product.
Please open an issue here: https://github.com/elastic/e2e-testing/issues/new