E2E tests are designed for verifying the functional correctness by replicating end-user behavior from app deployment. This describes how to run e2e tests in local dev environment and run them through CI
- Set up Dapr development environment
- Install the latest Helm v3
- Create your DockerHub ID
- Set the environment variables
export DAPR_REGISTRY=docker.io/your_dockerhub_id export DAPR_TAG=dev export DAPR_NAMESPACE=dapr-tests export DAPR_MTLS_ENABLED=true # If you want to run tests against Windows or arm kubernetes clusters, uncomment and set these # export TARGET_OS=linux # export TARGET_ARCH=amd64 # If you are cross compiling (building on MacOS/Windows and running against a Linux Kubernetes cluster # or vice versa) uncomment and set these # export GOOS=linux # export GOARCH=amd64 # Do not set DAPR_TEST_ENV if you do not use minikube export DAPR_TEST_ENV=minikube
export MINIKUBE_NODE_IP=your_k8s_master_ip
# Set the below environment variables if you want to use the different registry and tag for test apps
# export DAPR_TEST_REGISTRY=docker.io/your_dockerhub_id
# export DARP_TEST_TAG=dev
# export DAPR_TEST_REGISTRY_SECRET=yourself_private_image_secret
```
If you are starting from scratch and just want to build dapr, deploy it, and run the e2e tests to your kubernetes cluster, do the following:
- Uninstall dapr, dapr-kafka, dapr-redis services, if it exists Make sure you have DAPR_NAMESPACE set properly before you do this!
helm uninstall dapr dapr-kafka dapr-redis -n $DAPR_NAMESPACE
- Remove the test namespace, if it exists
make delete-test-namespace
- Build, deploy, run tests from start to finish
make e2e-build-deploy-run
We also have individual targets to allow for quick iteration on parts of deployment and testing. To follow all or part of these steps individually, do the following:
Create dapr-tests namespace
make create-test-namespace
Install redis and kafka for state, pubsub, and binding building block
make setup-helm-init
make setup-test-env-redis
# This may take a few minutes. You can skip kafka install if you do not use bindings for your tests.
make setup-test-env-kafka
Run the below commands to build and deploy dapr from your local disk
# Build Linux binaries
make build-linux
# Build Docker image with Linux binaries
make docker-build
# Push docker image to your dockerhub registry
make docker-push
# Deploy Dapr runtime to your cluster
make docker-deploy-k8s
make setup-disable-mtls
make setup-test-components
Build docker images from apps and push the images to test docker hub
# build e2e apps docker image under apps/
make build-e2e-app-all
# push e2e apps docker image to docker hub
make push-e2e-app-all
Run end-to-end tests
# start e2e test
make test-e2e-all
To completely remove Dapr, test dependencies, and any lingering e2e test apps: Make sure you have DAPR_NAMESPACE set properly before you do this!
# Uninstall dapr, dapr-kafka, dapr-redis services
helm uninstall dapr dapr-kafka dapr-redis -n $DAPR_NAMESPACE
# Remove the test namespace
make delete-test-namespace
To keep the build infrastructure simple, Dapr uses dapr-test GitHub Actions Workflow to run e2e tests using one of AKS clusters. A separate workflow also runs E2E in KinD clusters.
Once a contributor creates a pull request, E2E tests on KinD clusters are automatically executed for faster feedback. In order to run the E2E tests on AKS, ask a maintainer or approver to add /ok-to-test
comment to the Pull Request.