Skip to content

Instantly share code, notes, and snippets.

aws s3 cp s3://$SCENARIOS_BUCKET/$SERVICE . --recursive
# Default environment variables
TASK_COUNT=10
source ./overwrites.env # Override TASK_COUNT & others if needed
./setup.sh && echo "Setup script finished." || echo "No setup.sh file found. Continuing..."
PAYLOAD=$( jq -n -c \
--arg tc "$TASK_COUNT" \
aws s3 cp --recursive s3://$SCENARIOS_S3_BUCKET/$SERVICE/ .
source overwrites.env
npx artillery run --config config.yaml -e $ENVIRONMENT spec.yml
config:
environments:
# Configure several environments and select which to run through the -e flag
local:
target: "http://localhost:8080"
preproduction:
target: "https://example-api.preproduction.mycorp.internal"
phases:
- duration: 120
arrivalRate: 5
scenarios:
# Each virtual user created by Artillery will run one of the scenarios,
# randomly choosing one based on the weight attribute
- name: "Add song to an existing collection"
weight: 5
flow:
- get:
# Defined on ./helpers.js, sets env specific auth headers
beforeRequest: "setAuthorizationHeaders"
url: "/v1/collections"
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: reviews-destination
spec:
host: reviews
subsets:
- name: v1
labels:
version: v1
retries:
attempts: 3
perTryTimeout: 2s
retryOn: gateway-error,connect-failure,refused-stream
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination:
...
spec:
containers:
- name: ratings
image: istio/examples-bookinfo-ratings-v1:1.14.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9080
env:
- name: SERVICE_VERSION
if (process.env.SERVICE_VERSION === 'v-faulty') {
if (Math.random() <= 0.5) // Break in half the calls
return getLocalReviewsServiceUnavailable(res)
return getLocalReviewsSuccessful(res, productId)
}
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- route:
- destination: