-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit & acceptance tests around db selection
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh -e | ||
|
||
export DB=2 | ||
|
||
echo "-> Filling Redis with Mock Data..." | ||
redis-cli -h redis -n $DB FLUSHDB | ||
/generator -output resp -type strings -n 100 | redis-cli -h redis -n $DB --pipe | ||
DBSIZE=`redis-cli -h redis -n $DB dbsize` | ||
|
||
echo "-> Dumping DB..." | ||
time /redis-dump-go -host redis -n 250 -db $DB -output resp >backup | ||
|
||
echo "-> Flushing DB and restoring dump..." | ||
redis-cli -h redis -n $DB FLUSHDB | ||
redis-cli -h redis -n $DB --pipe <backup | ||
NEWDBSIZE=`redis-cli -h redis -n $DB dbsize` | ||
echo "Redis has $DBSIZE entries" | ||
|
||
echo "-> Comparing DB sizes..." | ||
if [ $DBSIZE -ne $NEWDBSIZE ]; then | ||
echo "ERROR - restored DB has $NEWDBSIZE elements, expected $DBSIZE" | ||
exit 1 | ||
else | ||
echo "OK - $NEWDBSIZE elements" | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters