diff options
-rwxr-xr-x | docker/prepare_env.sh | 5 | ||||
-rw-r--r-- | testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml | 4 | ||||
-rwxr-xr-x | testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py | 44 | ||||
-rwxr-xr-x[-rw-r--r--] | testcases/VIM/OpenStack/CI/libraries/run_rally.py | 54 |
4 files changed, 62 insertions, 45 deletions
diff --git a/docker/prepare_env.sh b/docker/prepare_env.sh index 4f1751baa..4106e3bde 100755 --- a/docker/prepare_env.sh +++ b/docker/prepare_env.sh @@ -184,6 +184,11 @@ if [ ${RALLY_COMMIT} != "latest" ]; then git reset --hard ${RALLY_COMMIT} fi +# IMPORTANT: To be removed when version 0.2.1 is out +git config --global user.email "functest@opnfv.com" +git config --global user.name "opnfv/functest" +git fetch https://review.openstack.org/openstack/rally refs/changes/06/270506/9 && git cherry-pick FETCH_HEAD + # Create directories mkdir -p ${FUNCTEST_CONF_DIR} diff --git a/testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml b/testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml index c8ec15222..8aeddc37c 100644 --- a/testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml +++ b/testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml @@ -1,6 +1,6 @@ fuel: images: ['TestVM'] - networks: ['net04', 'net04_ext'] + networks: ['net04', 'net04_ext', 'admin_floating'] routers: ['router04'] security_groups: ['default'] tenants: ['admin', 'services'] @@ -28,4 +28,4 @@ joid: users: ['admin', 'glance', 'nova', 'neutron', 'heat-cfn_heat', 'ceilometer', 'cinder_cinderv2', 'swift'] common: networks: ['functest-net'] - routers: ['functest-router'] + routers: ['functest-router']
\ No newline at end of file diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py index 13066b3df..1c27b0273 100755 --- a/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_rally-cert.py @@ -49,12 +49,19 @@ parser.add_argument("-r", "--report", parser.add_argument("-s", "--smoke", help="Smoke test mode", action="store_true") +parser.add_argument("-v", "--verbose", + help="Print verbose info about the progress", + action="store_true") args = parser.parse_args() client_dict = {} -FNULL = open(os.devnull, 'w') +if args.verbose: + RALLY_STDERR = subprocess.STDOUT +else: + RALLY_STDERR = open(os.devnull, 'w') + """ logging configuration """ logger = logging.getLogger("run_rally") logger.setLevel(logging.DEBUG) @@ -211,7 +218,7 @@ def run_task(test_name): "--task-args \"{}\" ".format(build_task_args(test_name)) logger.debug('running command line : {}'.format(cmd_line)) - p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=FNULL, shell=True) + p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True) result = "" while p.poll() is None: l = p.stdout.readline() @@ -282,20 +289,22 @@ def main(): client_dict['neutron'] = neutron_client - logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, GLANCE_IMAGE_PATH)) - image_id = functest_utils.create_glance_image(glance_client, - GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH) - if not image_id: - logger.error("Failed to create a Glance image...") - exit(-1) - # Check if the given image exists - try: - nova_client.images.find(name=GLANCE_IMAGE_NAME) - logger.info("Glance image found '%s'" % GLANCE_IMAGE_NAME) - except: - logger.error("ERROR: Glance image '%s' not found." % GLANCE_IMAGE_NAME) - logger.info("Available images are: ") - exit(-1) + image_id = functest_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME) + + if image_id == '': + logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, \ + GLANCE_IMAGE_PATH)) + image_id = functest_utils.create_glance_image(glance_client,\ + GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH) + if not image_id: + logger.error("Failed to create the Glance image...") + exit(-1) + else: + logger.debug("Image '%s' with ID '%s' created succesfully ." \ + % (GLANCE_IMAGE_NAME, image_id)) + else: + logger.debug("Using existing image '%s' with ID '%s'..." \ + % (GLANCE_IMAGE_NAME,image_id)) if args.test_name == "all": for test_name in tests: @@ -307,7 +316,8 @@ def main(): print(args.test_name) run_task(args.test_name) - logger.debug("Deleting image...") + logger.debug("Deleting image '%s' with ID '%s'..." \ + % (GLANCE_IMAGE_NAME, image_id)) if not functest_utils.delete_glance_image(nova_client, image_id): logger.error("Error deleting the glance image") diff --git a/testcases/VIM/OpenStack/CI/libraries/run_rally.py b/testcases/VIM/OpenStack/CI/libraries/run_rally.py index b879758ca..d1088014c 100644..100755 --- a/testcases/VIM/OpenStack/CI/libraries/run_rally.py +++ b/testcases/VIM/OpenStack/CI/libraries/run_rally.py @@ -44,11 +44,17 @@ parser.add_argument("-d", "--debug", help="Debug mode", action="store_true") parser.add_argument("-r", "--report", help="Create json result file", action="store_true") +parser.add_argument("-v", "--verbose", + help="Print verbose info about the progress", + action="store_true") args = parser.parse_args() +if args.verbose: + RALLY_STDERR = subprocess.STDOUT +else: + RALLY_STDERR = open(os.devnull, 'w') -FNULL = open(os.devnull, 'w') """ logging configuration """ logger = logging.getLogger("run_rally") logger.setLevel(logging.DEBUG) @@ -122,16 +128,6 @@ def get_task_id(cmd_raw): return None -def create_glance_image(path, name, disk_format): - """ - Create a glance image given the absolute path of the image, its name and the disk format - """ - cmd = ("glance image-create --name " + name + " --visibility public " - "--disk-format " + disk_format + " --container-format bare --file " + path) - functest_utils.execute_command(cmd, logger) - return True - - def task_succeed(json_raw): """ Parse JSON from rally JSON results @@ -174,7 +170,7 @@ def run_task(test_name): logger.debug('Scenario fetched from : {}'.format(test_file_name)) cmd_line = "rally task start --abort-on-sla-failure {}".format(test_file_name) logger.debug('running command line : {}'.format(cmd_line)) - p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=FNULL, shell=True) + p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE, stderr=RALLY_STDERR, shell=True) result = "" while p.poll() is None: l = p.stdout.readline() @@ -244,20 +240,24 @@ def main(): glance_client = glanceclient.Client(1, glance_endpoint, token=keystone_client.auth_token) - logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, GLANCE_IMAGE_PATH)) - image_id = functest_utils.create_glance_image(glance_client, - GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH) - if not image_id: - logger.error("Failed to create a Glance image...") - exit(-1) - # Check if the given image exists - try: - nova_client.images.find(name=GLANCE_IMAGE_NAME) - logger.info("Glance image found '%s'" % GLANCE_IMAGE_NAME) - except: - logger.error("ERROR: Glance image '%s' not found." % GLANCE_IMAGE_NAME) - logger.info("Available images are: ") - exit(-1) + + image_id = functest_utils.get_image_id(glance_client, GLANCE_IMAGE_NAME) + + if image_id == '': + logger.debug("Creating image '%s' from '%s'..." % (GLANCE_IMAGE_NAME, \ + GLANCE_IMAGE_PATH)) + image_id = functest_utils.create_glance_image(glance_client,\ + GLANCE_IMAGE_NAME,GLANCE_IMAGE_PATH) + if not image_id: + logger.error("Failed to create the Glance image...") + exit(-1) + else: + logger.debug("Image '%s' with ID '%s' created succesfully ." \ + % (GLANCE_IMAGE_NAME, image_id)) + else: + logger.debug("Using existing image '%s' with ID '%s'..." \ + % (GLANCE_IMAGE_NAME,image_id)) + if args.test_name == "all": for test_name in tests: @@ -272,6 +272,8 @@ def main(): print(args.test_name) run_task(args.test_name) + logger.debug("Deleting image '%s' with ID '%s'..." \ + % (GLANCE_IMAGE_NAME, image_id)) if not functest_utils.delete_glance_image(nova_client, image_id): logger.error("Error deleting the glance image") |