Skip to content

Commit 0224ff4

Browse files
authored
CI fixes (#46)
- Add BOTO_CONFIG env to fix travis-ci, thanks @loomchild @MattSurabian - Switch dynalite to AWS DynamoDB Local - Remove nodejs requirement - Fix tests to work with DynamoDB Local - Update readme
1 parent 5e2de43 commit 0224ff4

File tree

3 files changed

+39
-31
lines changed

3 files changed

+39
-31
lines changed

.travis.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
language: python
2+
env:
3+
- BOTO_CONFIG=/dev/null
24
python:
35
- "2.7"
6+
before_install:
7+
# install and run latest DynamoDB Local
8+
- mkdir /tmp/dynamodb_local
9+
- wget -O - https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz | tar xz --directory /tmp/dynamodb_local
10+
- java -Djava.library.path=/tmp/dynamodb_local/DynamoDBLocal_lib -jar /tmp/dynamodb_local/DynamoDBLocal.jar -sharedDb -inMemory &
411
install:
512
- pip install -r requirements.txt
613
- pip install flake8
7-
- nvm install 4
8-
- nvm use 4
9-
- npm install dynalite
1014
script:
11-
- flake8 --ignore=E501 --exclude=node_modules
12-
- dynalite --port 4567 &
15+
- flake8 --ignore=E501
1316
- mkdir dump && cp -a test/testTable dump
14-
- python dynamodump.py -m restore -r local -s testTable -d testRestoredTable --host localhost --port 4567 --accessKey a --secretKey a
15-
- python dynamodump.py -m backup -r local -s testRestoredTable --host localhost --port 4567 --accessKey a --secretKey a
17+
# test basic restore and backup
18+
- python dynamodump.py -m restore -r local -s testTable -d testRestoredTable --host localhost --port 8000 --accessKey a --secretKey a
19+
- python dynamodump.py -m backup -r local -s testRestoredTable --host localhost --port 8000 --accessKey a --secretKey a
1620
- python test/test.py
17-
- python dynamodump.py -m restore -r local -s "*" --host localhost --port 4567 --accessKey a --secretKey a
21+
# test wildcard restore and backup
22+
- python dynamodump.py -m restore -r local -s "*" --host localhost --port 8000 --accessKey a --secretKey a
1823
- rm -rf dump/test*
19-
- python dynamodump.py -m backup -r local -s "*" --host localhost --port 4567 --accessKey a --secretKey a
24+
- python dynamodump.py -m backup -r local -s "*" --host localhost --port 8000 --accessKey a --secretKey a
2025
- python test/test.py
21-
- python dynamodump.py -m restore -r local -s "test*" --host localhost --port 4567 --accessKey a --secretKey a --prefixSeparator ""
26+
# test prefixed wildcard restore and backup
27+
- python dynamodump.py -m restore -r local -s "test*" --host localhost --port 8000 --accessKey a --secretKey a --prefixSeparator ""
2228
- rm -rf dump/test*
23-
- python dynamodump.py -m backup -r local -s "test*" --host localhost --port 4567 --accessKey a --secretKey a --prefixSeparator ""
29+
- python dynamodump.py -m backup -r local -s "test*" --host localhost --port 8000 --accessKey a --secretKey a --prefixSeparator ""
2430
- python test/test.py
2531
matrix:
2632
fast_finish: true

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Simple backup and restore script for Amazon DynamoDB using boto to work similarl
77

88
Suitable for DynamoDB usages of smaller data volume which do not warrant the usage of AWS Data Pipeline for backup/restores/empty.
99

10-
dynamodump supports local DynamoDB instances as well (tested with [dynalite](https://github.com/mhart/dynalite)).
10+
dynamodump supports local DynamoDB instances as well (tested with [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html)).
1111

1212
Usage
1313
-----
@@ -141,10 +141,10 @@ python2 dynamodump.py -a tar -b some_s3_bucket -m restore -r us-east-1 -p profil
141141

142142
Local example
143143
-------------
144-
The following assume your local DynamoDB is running on localhost:4567 and is accessible via 'a' as access/secret keys.
144+
The following assume your local DynamoDB is running on localhost:8000 and is accessible via 'a' as access/secret keys.
145145
```
146-
python dynamodump.py -m backup -r local -s testTable --host localhost --port 4567 --accessKey a --secretKey a
146+
python dynamodump.py -m backup -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a
147147
148-
python dynamodump.py -m restore -r local -s testTable --host localhost --port 4567 --accessKey a --secretKey a
148+
python dynamodump.py -m restore -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a
149149
```
150150
Multiple table backup/restore as stated in the AWS examples are also available for local.

test/testTable/schema.json

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
{
22
"Table": {
3-
"TableArn": "arn:aws:dynamodb:us-east-1:000000000000:table/testTable",
3+
"TableArn": "arn:aws:dynamodb:ddblocal:000000000000:table/testTable",
44
"AttributeDefinitions": [
55
{
6-
"AttributeName": "id",
6+
"AttributeName": "id",
77
"AttributeType": "N"
88
}
9-
],
9+
],
1010
"ProvisionedThroughput": {
11-
"WriteCapacityUnits": 25,
12-
"NumberOfDecreasesToday": 1,
13-
"ReadCapacityUnits": 1,
14-
"LastDecreaseDateTime": 1471785062.495
15-
},
16-
"TableSizeBytes": 0,
17-
"TableName": "testTable",
18-
"TableStatus": "ACTIVE",
11+
"NumberOfDecreasesToday": 0,
12+
"WriteCapacityUnits": 25,
13+
"LastIncreaseDateTime": 0.0,
14+
"NumberOfDecreasesToday": 0,
15+
"ReadCapacityUnits": 1,
16+
"LastDecreaseDateTime": 0.0
17+
},
18+
"TableSizeBytes": 28,
19+
"TableName": "testTable",
20+
"TableStatus": "ACTIVE",
1921
"KeySchema": [
2022
{
21-
"KeyType": "HASH",
23+
"KeyType": "HASH",
2224
"AttributeName": "id"
2325
}
24-
],
25-
"ItemCount": 0,
26-
"CreationDateTime": 1471785060.962
26+
],
27+
"ItemCount": 1,
28+
"CreationDateTime": 1517103019.926
2729
}
28-
}
30+
}

0 commit comments

Comments
 (0)