refstack-client test failure with test-list option

Bug #1516458 reported by Catherine Diep
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
refstack
Fix Released
Undecided
Catherine Diep

Bug Description

refstack-client test fails when testing with the test-list option. To fix this issue, refstack-client needs to initialize the environment variables "TEMPEST_CONFIG_DIR" and "TEMPEST_CONFIG" with the configuration file path value passed in by the caller.

(.venv)cdiep@cdiep-VirtualBox:~/refstack-client-20151115-list-tests/refstack-client$ ./refstack-client test -c ~/tempest.conf.142.short -v --test-list ~/2015.07.required.txt
2015-11-15 14:47:35,467 refstack_client:126 DEBUG The .testrepository/next-stream file was not found. Assuming subunit results will be stored in file 0.
2015-11-15 14:47:35,589 refstack_client:313 INFO Starting Tempest test...
2015-11-15 14:47:35,589 refstack_client:323 INFO Normalizing test list...
2015-11-15 14:47:36.149 24769 INFO tempest [-] Using tempest config file /etc/tempest/tempest.conf
Non-zero exit code (2) from test listing.
2015-11-15 14:47:37,018 refstack_client.list_parser:53 ERROR None
Traceback (most recent call last):
  File "./refstack-client", line 31, in <module>
    getattr(test, args.func)()
  File "/home/cdiep/refstack-client-20151115-list-tests/refstack-client/refstack_client/refstack_client.py", line 326, in test
    list_file = parser.get_normalized_test_list(self.args.test_list)
  File "/home/cdiep/refstack-client-20151115-list-tests/refstack-client/refstack_client/list_parser.py", line 199, in get_normalized_test_list
    tempest_test_ids = self._get_tempest_test_ids()
  File "/home/cdiep/refstack-client-20151115-list-tests/refstack-client/refstack_client/list_parser.py", line 55, in _get_tempest_test_ids
    ' '.join(cmd))
subprocess.CalledProcessError: Command '/home/cdiep/refstack-client-20151115-list-tests/refstack-client/.tempest/tools/with_venv.sh testr list-tests' returned non-zero exit status 3

With test-list option, refstack-client will first normalize the user input test list to the test list from the currently installed Tempest. There seems to be some non RefStack updates in the recent releases that "testr list-tests" would now require a valid tempest.conf for test listing. The path of the tempest.conf file is determined by the .tempest/tempest/config.py module. If a tempest.conf file is not found, then the failsafe file is used, namely /etc/tempest/tempest.conf" which does not exist in RefStack.

    def __init__(self, parse_conf=True, config_path=None):
        """Initialize a configuration from a conf directory and conf file."""
        super(TempestConfigPrivate, self).__init__()
        config_files = []
        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE

        if config_path:
            path = config_path
        else:
            # Environment variables override defaults...
            conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
                                      self.DEFAULT_CONFIG_DIR)
            conf_file = os.environ.get('TEMPEST_CONFIG',
                                       self.DEFAULT_CONFIG_FILE)

            path = os.path.join(conf_dir, conf_file)

        if not os.path.isfile(path):
            path = failsafe_path

        # only parse the config file if we expect one to exist. This is needed
        # to remove an issue with the config file up to date checker.
        if parse_conf:
            config_files.append(path)
        logging.register_options(_CONF)
        if os.path.isfile(path):
            _CONF([], project='tempest', default_config_files=config_files)
        else:
            _CONF([], project='tempest')
        logging.setup(_CONF, 'tempest')
        LOG = logging.getLogger('tempest')
        LOG.info("Using tempest config file %s" % path)
        register_opts()
        self._set_attrs()
        if parse_conf:
            _CONF.log_opt_values(LOG, std_logging.DEBUG)

Catherine Diep (cdiep)
Changed in refstack:
assignee: nobody → Catherine Diep (cdiep)
Catherine Diep (cdiep)
description: updated
Revision history for this message
Catherine Diep (cdiep) wrote :

This bug was fixed with https://review.openstack.org/#/c/247179/ merged on Nov 20, 2015

Changed in refstack:
status: New → Fix Committed
Catherine Diep (cdiep)
Changed in refstack:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.