diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/fetch_os_creds.sh | 14 | ||||
-rw-r--r-- | utils/push-test-logs.sh | 2 | ||||
-rwxr-xr-x | utils/test/testapi/install.sh | 14 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/models.py | 8 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/resources/result_models.py | 2 | ||||
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_result.py | 6 |
6 files changed, 33 insertions, 13 deletions
diff --git a/utils/fetch_os_creds.sh b/utils/fetch_os_creds.sh index 47fbc91dc..ecc571dba 100755 --- a/utils/fetch_os_creds.sh +++ b/utils/fetch_os_creds.sh @@ -144,9 +144,17 @@ elif [ "$installer_type" == "compass" ]; then sshpass -p root scp 2>/dev/null $ssh_options root@${installer_ip}:~/admin-openrc.sh $dest_path &> /dev/null info "This file contains the mgmt keystone API, we need the public one for our rc file" - public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ - "ssh ${controller_ip} 'source /opt/admin-openrc.sh; openstack endpoint show identity '" \ - | grep publicurl | awk '{print $4}') + grep "OS_AUTH_URL.*v2" $dest_path > /dev/null 2>&1 + if [ $? -eq 0 ] ; then + public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ + "ssh ${controller_ip} 'source /opt/admin-openrc.sh; openstack endpoint show identity '" \ + | grep publicurl | awk '{print $4}') + else + public_ip=$(sshpass -p root ssh $ssh_options root@${installer_ip} \ + "ssh ${controller_ip} 'source /opt/admin-openrc.sh; \ + openstack endpoint list --interface public --service identity '" \ + | grep identity | awk '{print $14}') + fi info "public_ip: $public_ip" diff --git a/utils/push-test-logs.sh b/utils/push-test-logs.sh index 586afce1b..913748f03 100644 --- a/utils/push-test-logs.sh +++ b/utils/push-test-logs.sh @@ -54,7 +54,7 @@ if [ -d "$dir_result" ]; then else gsutil ls gs://artifacts.opnfv.org/"$project"/ &>/dev/null if [ $? != 0 ]; then - echo "Not possible to push results to artifact: gsutil not installed."; + echo "Not possible to push results to artifact: some error happened when using gsutil"; else echo "Uploading logs to artifact $project_artifact" gsutil -m cp -r "$dir_result"/* gs://artifacts.opnfv.org/"$project_artifact"/ >/dev/null 2>&1 diff --git a/utils/test/testapi/install.sh b/utils/test/testapi/install.sh index 43229eabb..c55691aed 100755 --- a/utils/test/testapi/install.sh +++ b/utils/test/testapi/install.sh @@ -10,9 +10,17 @@ usage: where: -h|--help show this help text" -if [[ $(whoami) != "root" ]]; then - echo "Error: This script must be run as root!" - exit 1 +# Ref :- https://openstack.nimeyo.com/87286/openstack-packaging-all-definition-data-files-config-setup + +if [ -z "$VIRTUAL_ENV" ]; +then + if [[ $(whoami) != "root" ]]; + then + echo "Error: This script must be run as root!" + exit 1 + fi +else + sed -i -e 's#/etc/opnfv_testapi =#etc/opnfv_testapi =#g' setup.cfg fi cp -fr 3rd_party/static opnfv_testapi/tornado_swagger diff --git a/utils/test/testapi/opnfv_testapi/resources/models.py b/utils/test/testapi/opnfv_testapi/resources/models.py index c85c1d5b1..f518c97a0 100644 --- a/utils/test/testapi/opnfv_testapi/resources/models.py +++ b/utils/test/testapi/opnfv_testapi/resources/models.py @@ -24,7 +24,6 @@ class ModelBase(object): def _format(self, excludes):
new_obj = copy.deepcopy(self)
dicts = new_obj.__dict__
- print self, self.__class__
for k in dicts.keys():
if k in excludes:
del dicts[k]
@@ -32,9 +31,9 @@ class ModelBase(object): if hasattr(dicts[k], 'format'):
dicts[k] = dicts[k].format()
elif isinstance(dicts[k], list):
- hs = []
- for h in dicts[k]:
- hs.append(h.format())
+ hs = list()
+ [hs.append(h.format() if hasattr(h, 'format') else str(h))
+ for h in dicts[k]]
dicts[k] = hs
elif not isinstance(dicts[k], (str, int, float, dict)):
dicts[k] = str(dicts[k])
@@ -71,6 +70,7 @@ class ModelBase(object): return t
+@swagger.model()
class CreateResponse(ModelBase):
def __init__(self, href=''):
self.href = href
diff --git a/utils/test/testapi/opnfv_testapi/resources/result_models.py b/utils/test/testapi/opnfv_testapi/resources/result_models.py index 30119020b..50445fc22 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_models.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_models.py @@ -112,7 +112,7 @@ class TestResult(models.ModelBase): @swagger.model() class TestResults(models.ModelBase): """ - @property rgit esults: + @property results: @ptype results: C{list} of L{TestResult} """ def __init__(self): diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py index 8479b35cd..10575a9f5 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_result.py @@ -25,12 +25,14 @@ class Details(object): self.timestart = timestart self.duration = duration self.status = status + self.items = [{'item1': 1}, {'item2': 2}] def format(self): return { "timestart": self.timestart, "duration": self.duration, - "status": self.status + "status": self.status, + 'items': [{'item1': 1}, {'item2': 2}] } @staticmethod @@ -43,6 +45,7 @@ class Details(object): t.timestart = a_dict.get('timestart') t.duration = a_dict.get('duration') t.status = a_dict.get('status') + t.items = a_dict.get('items') return t @@ -104,6 +107,7 @@ class TestResultBase(TestBase): self.assertEqual(details_res.duration, details_req.duration) self.assertEqual(details_res.timestart, details_req.timestart) self.assertEqual(details_res.status, details_req.status) + self.assertEqual(details_res.items, details_req.items) self.assertEqual(result.build_tag, req.build_tag) self.assertEqual(result.scenario, req.scenario) self.assertEqual(result.criteria, req.criteria) |