summaryrefslogtreecommitdiffstats
path: root/utils/test/scripts
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-03-10 09:34:38 +0100
committerMorgan Richomme <morgan.richomme@orange.com>2016-03-10 11:05:12 +0100
commit2c14b92a08106976cdce2d21d4daa6179e139048 (patch)
tree128e5f69ceadd3fee1792c46811eb4ddf9b1c254 /utils/test/scripts
parente17429d4c54a5c559429c0f5ffcd7da90fa2ebc7 (diff)
reorganization of Test folder in Releng
Change-Id: I92b507105e820198691ab8b1c44e1011b983b849 Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/test/scripts')
-rw-r--r--utils/test/scripts/backup-db.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/utils/test/scripts/backup-db.sh b/utils/test/scripts/backup-db.sh
new file mode 100644
index 000000000..aa36aa370
--- /dev/null
+++ b/utils/test/scripts/backup-db.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2016 Orange and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+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