add update usage description in testAPI
[releng.git] / utils / test / result_collection_api / update / README.md
1 # opnfv-testapi update
2
3 ## How to use:
4
5 # backup mongodb,
6 # arguments:
7 # -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
8 # -o/--output_dir: Output directory for the backup, default = ./
9 # the backup output will be put under dir/db__XXXX_XX_XX_XXXXXX/db
10 # -d/--db: database for the backup, default = test_results_collection
11 ```
12 python backup.py
13 ```
14
15 # restore mongodb
16 # arguments:
17 # -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
18 # -i/--input_dir: Input directory for the Restore, must be specified
19 # the restore input must be specified to dir/db__XXXX_XX_XX_XXXXXX/db
20 # -d/--db: database name after the restore, default = basename of input_dir
21 ```
22 python restore.py
23 ```
24
25 # update mongodb
26 # arguments:
27 # -u/--url: Mongo DB URL, default = mongodb://127.0.0.1:27017/
28 # -d/--db: database name to be updated, default = test_results_collection
29 # changes need to be done:
30 # change collection name, modify changes.collections_old2New
31 # collections_old2New = {
32 #     'old_collection': 'new_collection',
33 # }
34 # change field name, modify changes.fields_old2New
35 # fields_old2New = {
36 #     'collection': [(query, {'old_field': 'new_field'})]
37 # }
38 # change the doc, modify changes.docs_old2New
39 # docs_old2New = {
40 #     'test_results': [
41 #         ({'field': 'old_value'}, {'field': 'new_value'}),
42 #         (query, {'field': 'new_value'}),
43 #     ]
44 # }
45 ```
46 python update.py
47 ```
48
49 # update opnfv-testapi process
50 # this script must be run right in this directory
51 # and remember to change ../etc/config.ini before running this script
52 # operations includes:
53 # kill running test_collection_api & opnfv-testapi
54 # install or update dependencies according to ../requirements.txt
55 # install opnfv-testapi
56 # run opnfv-testapi
57 ```
58 python update_api.py
59 ```