summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan Richomme <morgan.richomme@orange.com>2016-06-08 06:45:46 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-08 06:45:46 +0000
commit519ac09777675829ded1a5f9a66bafcc6015d8c2 (patch)
treeeeee0a4e0e09a9624df063fd58051ef86778820e
parentcf2a9cff0d29c611349f8e058017bf4600dc1f36 (diff)
parent3840e299faae0e10d951d5b74b395c1fc264eb78 (diff)
Merge "add update usage description in testAPI"
-rw-r--r--utils/test/result_collection_api/update/README.md59
-rw-r--r--utils/test/result_collection_api/update/restore.py5
2 files changed, 61 insertions, 3 deletions
diff --git a/utils/test/result_collection_api/update/README.md b/utils/test/result_collection_api/update/README.md
new file mode 100644
index 000000000..41b7fffa3
--- /dev/null
+++ b/utils/test/result_collection_api/update/README.md
@@ -0,0 +1,59 @@
+# opnfv-testapi update
+
+## How to use:
+
+# backup mongodb,
+# arguments:
+# -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
+# -o/--output_dir: Output directory for the backup, default = ./
+# the backup output will be put under dir/db__XXXX_XX_XX_XXXXXX/db
+# -d/--db: database for the backup, default = test_results_collection
+```
+python backup.py
+```
+
+# restore mongodb
+# arguments:
+# -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
+# -i/--input_dir: Input directory for the Restore, must be specified
+# the restore input must be specified to dir/db__XXXX_XX_XX_XXXXXX/db
+# -d/--db: database name after the restore, default = basename of input_dir
+```
+python restore.py
+```
+
+# update mongodb
+# arguments:
+# -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
+# -d/--db: database name to be updated, default = test_results_collection
+# changes need to be done:
+# change collection name, modify changes.collections_old2New
+# collections_old2New = {
+# 'old_collection': 'new_collection',
+# }
+# change field name, modify changes.fields_old2New
+# fields_old2New = {
+# 'collection': [(query, {'old_field': 'new_field'})]
+# }
+# change the doc, modify changes.docs_old2New
+# docs_old2New = {
+# 'test_results': [
+# ({'field': 'old_value'}, {'field': 'new_value'}),
+# (query, {'field': 'new_value'}),
+# ]
+# }
+```
+python update.py
+```
+
+# update opnfv-testapi process
+# this script must be run right in this directory
+# and remember to change ../etc/config.ini before running this script
+# operations includes:
+# kill running test_collection_api & opnfv-testapi
+# install or update dependencies according to ../requirements.txt
+# install opnfv-testapi
+# run opnfv-testapi
+```
+python update_api.py
+```
diff --git a/utils/test/result_collection_api/update/restore.py b/utils/test/result_collection_api/update/restore.py
index a2b65f321..c3e06cc1c 100644
--- a/utils/test/result_collection_api/update/restore.py
+++ b/utils/test/result_collection_api/update/restore.py
@@ -19,14 +19,13 @@ parser.add_argument('-u', '--url',
help='Mongo DB URL for Backup')
parser.add_argument('-i', '--input_dir',
type=str,
- required=False,
- default='./',
+ required=True,
help='Input directory for the Restore.')
parser.add_argument('-d', '--db',
type=str,
required=False,
default=None,
- help='database for the restore.')
+ help='database name after the restore.')
def restore(args):