aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfunctest/ci/config_functest.yaml2
-rw-r--r--functest/utils/decorators.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 4d5a62175..78f6257c8 100755
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -200,4 +200,6 @@ example:
sg_desc: Example Security group
results:
+ # you can also set a dir (e.g. /home/opnfv/db) to dump results
+ # test_db_url: file:///home/opnfv/db
test_db_url: http://testresults.opnfv.org/test/api/v1
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 99bcef3e6..276235d96 100644
--- a/functest/utils/decorators.py
+++ b/functest/utils/decorators.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
+import errno
import mock
+import os
import requests.sessions
import urlparse
@@ -10,7 +12,12 @@ def can_dump_request_to_file(method):
def dump_preparedrequest(request, **kwargs):
parseresult = urlparse.urlparse(request.url)
if parseresult.scheme == "file":
- with open(parseresult.path.replace('/results', ''), 'a') as f:
+ try:
+ os.makedirs(parseresult.path)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ with open(os.path.join(parseresult.path, 'dump.txt'), 'a') as f:
headers = ""
for key in request.headers:
headers += key + " " + request.headers[key] + "\n"