-
Notifications
You must be signed in to change notification settings - Fork 4
/
local-test.sh
executable file
·33 lines (24 loc) · 1.02 KB
/
local-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
set -euo pipefail
if [ -z ${GITHUB_RUN_ID+x} ]; then
docker-compose -f example/docker-compose.yml up -d localstack
fi
export AWS_ACCESS_KEY_ID=foo
export AWS_SECRET_ACCESS_KEY=bar
export AWS_REGION=eu-west-1
export AWS_ENDPOINT=http://localhost:4566
go install github.com/k6io/xk6/cmd/xk6@latest
xk6 build \
--with github.com/mridehalgh/xk6-sqs@latest=.
QUEUE_NAME=dummy-k6-queue
timeout 22 sh -c 'until aws --endpoint-url=http://localhost:4566 sqs list-queues; do sleep 0.1 && echo "Sleeping"; done'
QUEUE_URL=$(aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name $QUEUE_NAME | jq -r '.QueueUrl')
aws --endpoint-url=http://localhost:4566 sqs purge-queue --queue-url $QUEUE_URL
./k6 run example/localstack.js
echo $QUEUE_URL
JSON=$(aws --endpoint-url=http://localhost:4566 \
--output=json \
sqs receive-message \
--queue-url $QUEUE_URL) \
|| die "failed to receive-message from SQS queue '$QUEUE_NAME'"
test $(echo $JSON | jq '.Messages | length' ) -eq 1 && echo "PASS"