What you'll learn
- How to install Artillery integration in Keptn
- How to trigger different kinds of tests with Keptn's test strategies
- How to run Artillery smoke tests and load tests in Keptn delivery pipelines
- How Keptn's SLO evaluation gates work with Artillery's performance metrics
Keptn is a cloud-native application lifecycle orchestration platform which automates observability, SLO-driven delivery, and operational remediation. Integrating Artillery in your Keptn delivery pipelines allows you to run pre and post-deployment load and smoke tests with Artillery to verify that new releases of a service work as expected and meet their performance SLOs.
Setting up Keptn Artillery Service
Artillery's official integration with Keptn is available on https://github.com/keptn-sandbox/artillery-service. To install the integration, clone the repository, and use
kubectl to install the integration:
kubectl apply -f deploy/service.yaml
This will install the
artillery-service service, along with a Keptn
distributor into the
keptn namespace on the Kubernetes cluster.
For information on upgrading or downgrading an existing installation, or uninstalling the integration, please refer to the
Running Artillery tests
The following Artillery code is a basic test for sock shop, a sample ecommerce service maintained by the Keptn project.
The URL of the current deployment may change between deployments. Current URL is injected into the Artillery environment automatically by the integration.
# Use the expectations plugin to run checks and assertions
# More information:
# Check that root path returns a 200:
- statusCode: 200
# Add an item to cart. We expect a 201 response to indicate success:
- statusCode: 201
Default Artillery test script
The integration will look for an Artillery test script in
scenarios/load.yaml by default. The file may be added to Keptn with the following command:
keptn add-resource --project=PROJECTNAME --service=SERVICENAME --stage=STAGENAME --resource=./scenarios/load.yaml --resourceUri=scenarios/load.yaml
Configuring test strategies
More advanced test strategies can be configured with a
artillery.conf.yaml file that can specify which Artillery tests should run for different stages of your Keptn pipeline.
The following example sets three different test strategies:
functional, for an end-to-end functional test of the service
performance, to run a load test
smokefor a smoke test (a health check)
- teststrategy: functional
- teststrategy: performance
- teststrategy: smoke
The configuration file can be applied with:
keptn add-resource --project=PROJECTNAME --service=SERVICENAME --all-stages --resource=artillery.conf.yaml --resourceUri=scenarios/artillery.conf.yaml
Quality gates and SLO checks
Keptn quality gates provide a way to define quality criteria of your service in a declarative way. All existing quality gates and SLO definitions work with this integration with no extra work required.
- Re-using Artillery test definitions for functional testing and load testing
- Automating performance and load tests with Artillery + Keptn - video presentation from the Keptn User Group