diff options
author | 2015-11-27 09:36:51 +0100 | |
---|---|---|
committer | 2015-11-30 18:38:07 +0100 | |
commit | e9fafa5edbe392f994f1b7b42cc77763c8e70526 (patch) | |
tree | 123fd137333eab8f8cc70aae313e62f01a34e608 /utils/test/result_collection_api/tools/backup-db.sh | |
parent | 99461785a9fa5541177db93b9a3e2e0c94dd75b7 (diff) |
Add tool to backup Mongo tables and postman collection as sample
JIRA: RELENG-7
Change-Id: Ib06c814fed7e808adbb913dbaf340044f27548b6
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/test/result_collection_api/tools/backup-db.sh')
-rw-r--r-- | utils/test/result_collection_api/tools/backup-db.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/utils/test/result_collection_api/tools/backup-db.sh b/utils/test/result_collection_api/tools/backup-db.sh new file mode 100644 index 000000000..8d12a6fc7 --- /dev/null +++ b/utils/test/result_collection_api/tools/backup-db.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +echo "Backup Test collection DB" +now=$(date +"%m_%d_%Y_%H_%M_%S") +echo $now +echo " ------------- " +TARGET_DIR=./$now +TEST_RESULT_DB_BACKUP="test_collection_db."$now".tar.gz" + +echo "Create Directory for backup" +mkdir -p $TARGET_DIR + +echo "Export results" +mongoexport -db test_results_collection -c test_results --out $TARGET_DIR/results.json +echo "Export test cases" +mongoexport --db test_results_collection -c test_cases --out $TARGET_DIR/backup-cases.json +echo "Export projects" +mongoexport --db test_results_collection -c test_projects --out $TARGET_DIR/backup-projects.json +echo "Export pods" +mongoexport --db test_results_collection -c pod --out $TARGET_DIR/backup-pod.json + +echo "Create tar.gz" +tar -cvzf $TEST_RESULT_DB_BACKUP $TARGET_DIR + +echo "Delete temp directory" +rm -Rf $TARGET_DIR |