Skip to content

Commit 77cf3cf

Browse files
authored
Merge pull request #78 from bchew/tests
chore: add dynamodb-local via docker-compose and tests shell script
2 parents aeaf6bc + 71fde53 commit 77cf3cf

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.8'
2+
services:
3+
dynamodb-local:
4+
command: "-jar DynamoDBLocal.jar -sharedDb -inMemory"
5+
image: "amazon/dynamodb-local:latest"
6+
container_name: dynamodb-local
7+
ports:
8+
- "8000:8000"

test.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash -e
2+
# Test script which assumes DynamoDB Local is ready and available via `docker-compose up`
3+
4+
# Test basic restore and backup
5+
mkdir -p dump && cp -a tests/testTable dump
6+
python dynamodump/dynamodump.py -m restore --noConfirm -r local -s testTable -d testRestoredTable \
7+
--host localhost --port 8000 --accessKey a --secretKey a
8+
python dynamodump/dynamodump.py -m backup -r local -s testRestoredTable --host localhost --port 8000 \
9+
--accessKey a --secretKey a
10+
python tests/test.py
11+
12+
# Test wildcard restore and backup
13+
python dynamodump/dynamodump.py -m restore --noConfirm -r local -s "*" --host localhost --port 8000 \
14+
--accessKey a --secretKey a
15+
rm -rf dump/test*
16+
python dynamodump/dynamodump.py -m backup -r local -s "*" --host localhost --port 8000 --accessKey a \
17+
--secretKey a
18+
python tests/test.py
19+
20+
# Test prefixed wildcard restore and backup
21+
python dynamodump/dynamodump.py -m restore --noConfirm -r local -s "test*" --host localhost --port 8000 \
22+
--accessKey a --secretKey a --prefixSeparator ""
23+
rm -rf dump/test*
24+
python dynamodump/dynamodump.py -m backup -r local -s "test*" --host localhost --port 8000 --accessKey a \
25+
--secretKey a --prefixSeparator ""
26+
python tests/test.py
27+
28+
# Clean up
29+
rm -rf dump/test*

0 commit comments

Comments
 (0)