Add 3 new HA test cases into proposed_tests test suite 97/51997/4
authorxudan <xudan16@huawei.com>
Sun, 11 Feb 2018 03:04:03 +0000 (22:04 -0500)
committerGeorg Kunz <georg.kunz@ericsson.com>
Mon, 19 Feb 2018 14:05:39 +0000 (15:05 +0100)
Add 3 new HA test cases into proposed_tests test suite and running them on CI.
For the current 8 HA test cases and 3 other HA test cases plans to add,
do some adaptions for the Yardstick Euphrates release.
1. Don't need the bugfix patch anymore.
2. The data format has changed, and has done some adaptions.
3. For Yardstick Euphrates, if setting OS_INSECURE=True, it needs to set
   OS_CACERT=False
4. Test case tc011 needs a image and flavor to create the stack.

JIRA: DOVETAIL-614
JIRA: DOVETAIL-586

Change-Id: I9da8c8316246b9edee0d81ad18422ae6018becaf
Signed-off-by: xudan <xudan16@huawei.com>
dovetail/compliance/proposed_tests.yml
dovetail/conf/yardstick_config.yml
dovetail/container.py
dovetail/report.py
dovetail/testcase/ha.tc009.yml [new file with mode: 0644]
dovetail/testcase/ha.tc010.yml [new file with mode: 0644]
dovetail/testcase/ha.tc011.yml [new file with mode: 0644]

index 594abf4..ad70cf6 100644 (file)
@@ -6,3 +6,7 @@ proposed_tests:
     # smoke
     - dovetail.smoke.tc001
     - dovetail.smoke.tc002
+    # HA
+    - dovetail.ha.tc009
+    - dovetail.ha.tc010
+    - dovetail.ha.tc011
index fea8cea..bbb2133 100644 (file)
@@ -1,30 +1,20 @@
 ---
 yardstick:
   image_name: opnfv/yardstick
-  docker_tag: danube.3.2
+  docker_tag: opnfv-5.1.0
   opts: '-id --privileged=true'
   config:
     dir: '/home/opnfv/userconfig'
   pre_condition:
-    # - 'cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
-    #     source tests/ci/clean_images.sh && cleanup'
-    # - 'cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
-    #     source tests/ci/load_images.sh'
-    # Copy Yardstick bugfix patches to Yardstick repository
-    - "cp -r /home/opnfv/userconfig/patch/ /home/opnfv/repos/yardstick/"
-    # Config git user info for applying bugfix patches
-    - "cd /home/opnfv/repos/yardstick && git config --global user.email 'you@example.com'"
-    - "cd /home/opnfv/repos/yardstick && git config --global user.name 'Your Name'"
-    # Apply all bugfix patchs on tempest code
-    - "cd /home/opnfv/repos/yardstick && git am ./patch/*.patch"
+    - 'echo this is pre_condition'
   cmds:
     - 'mkdir -p /home/opnfv/yardstick/results/'
-    - "cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
+    - "cd /home/opnfv/repos/yardstick && source /etc/yardstick/openstack.creds &&
          yardstick task start tests/opnfv/test_cases/{{validate_testcase}}.yaml
          --output-file /home/opnfv/yardstick/results/{{testcase}}.out
          --task-args '{'file': '/home/opnfv/userconfig/pre_config/pod.yaml'}'"
   post_condition:
-    - ''
+    - 'echo this is post_condition'
   result:
     dir: '/home/opnfv/yardstick/results'
     log: '/tmp/yardstick'
index ca37d81..8069ea4 100644 (file)
@@ -106,6 +106,9 @@ class Container(object):
         else:
             cls.logger.error("Can't find any external network.")
             return None
+        insecure = os.getenv("OS_INSECURE")
+        if insecure and insecure.lower() == 'true':
+            envs = envs + " -e OS_CACERT=False "
 
         log_vol = '-v %s:%s ' % (dovetail_config['result_dir'],
                                  dovetail_config["yardstick"]['result']['log'])
@@ -356,9 +359,9 @@ class Container(object):
         cls.pre_copy(container_id, src, dest)
         url = dt_cfg.dovetail_config['report_dest']
         if url.startswith("http"):
-            cmd = ("sed -i '16s#http://127.0.0.1:8000/results#{}#g' {}"
+            cmd = ("sed -i '17s#http://127.0.0.1:8000/results#{}#g' {}"
                    .format(url, dest))
             cls.exec_cmd(container_id, cmd)
         if url.lower() == 'file':
-            cmd = ("sed -i '12s/http/file/g' {}".format(dest))
+            cmd = ("sed -i '13s/http/file/g' {}".format(dest))
             cls.exec_cmd(container_id, cmd)
index 91d6d9b..9d0517b 100644 (file)
@@ -341,14 +341,16 @@ class YardstickCrawler(object):
         with open(file_path, 'r') as f:
             for jsonfile in f:
                 data = json.loads(jsonfile)
-                if 1 == data['status']:
-                    try:
-                        v = data['result'][1]['benchmark']['data']['sla_pass']
-                        if 1 == v:
-                            criteria = 'PASS'
-                    except KeyError as e:
-                        self.logger.exception(
-                            'Pass flag not found {}'.format(e))
+                try:
+                    criteria = data['result']['criteria']
+                    if criteria == 'PASS':
+                        valid_tc = testcase.validate_testcase()
+                        details = data['result']['testcases'][valid_tc]
+                        sla_pass = details['tc_data'][0]['data']['sla_pass']
+                        if not 1 == sla_pass:
+                            criteria = 'FAIL'
+                except KeyError as e:
+                    self.logger.exception('Pass flag not found {}'.format(e))
         json_results = {'criteria': criteria}
         self.logger.debug('Results: {}'.format(str(json_results)))
         return json_results
diff --git a/dovetail/testcase/ha.tc009.yml b/dovetail/testcase/ha.tc009.yml
new file mode 100644 (file)
index 0000000..10f4e50
--- /dev/null
@@ -0,0 +1,9 @@
+---
+dovetail.ha.tc009:
+  name: dovetail.ha.tc009
+  objective: > # OpenStack Controll Node abnormally shutdown.
+  validate:
+    type: yardstick
+    testcase: opnfv_yardstick_tc025
+  report:
+    sub_testcase_list:
diff --git a/dovetail/testcase/ha.tc010.yml b/dovetail/testcase/ha.tc010.yml
new file mode 100644 (file)
index 0000000..6508a4d
--- /dev/null
@@ -0,0 +1,9 @@
+---
+dovetail.ha.tc010:
+  name: dovetail.ha.tc010
+  objective: > # OpenStack Controller Messaging Queue Service High Availability.
+  validate:
+    type: yardstick
+    testcase: opnfv_yardstick_tc056
+  report:
+    sub_testcase_list:
diff --git a/dovetail/testcase/ha.tc011.yml b/dovetail/testcase/ha.tc011.yml
new file mode 100644 (file)
index 0000000..d126882
--- /dev/null
@@ -0,0 +1,22 @@
+---
+dovetail.ha.tc011:
+  name: dovetail.ha.tc011
+  objective: > # OpenStack Controller Virtual Router Service High Availability.
+  validate:
+    type: yardstick
+    testcase: opnfv_yardstick_tc058
+    pre_condition:
+      - 'source /etc/yardstick/openstack.creds && openstack --insecure image create cirros-ha-11
+         --disk-format qcow2 --container-format bare --public
+         --file /home/opnfv/userconfig/pre_config/cirros-0.3.5-x86_64-disk.img'
+    cmds:
+      - 'mkdir -p /home/opnfv/yardstick/results/'
+      - "cd /home/opnfv/repos/yardstick && source /etc/yardstick/openstack.creds &&
+         yardstick task start tests/opnfv/test_cases/{{validate_testcase}}.yaml
+         --output-file /home/opnfv/yardstick/results/{{testcase}}.out
+         --task-args '{'file': '/home/opnfv/userconfig/pre_config/pod.yaml',
+         'image': 'cirros-ha-11', 'flavor': 'm1.tiny'}'"
+    post_condition:
+      - 'source /etc/yardstick/openstack.creds && openstack --insecure image delete cirros-ha-11'
+  report:
+    sub_testcase_list: