def test_get_db_url_env_var(self):
     with mock.patch.dict(os.environ,
                          {'TEST_DB_URL': self.db_url_env,
                           'CONFIG_FUNCTEST_YAML':
                           "./functest/ci/config_functest.yaml"},
                          clear=True):
         self.assertEqual(functest_utils.get_db_url(),
                          self.db_url_env)
Exemple #2
0
def get_data(test, results):
    test_result = test['result']
    url = ''
    for test_db in results:
        if test['test_name'] in test_db['case_name']:
            id = test_db['_id']
            url = ft_utils.get_db_url() + '/results/' + id
            test_result = test_db['criteria']

    return {"url": url, "result": test_result}
Exemple #3
0
def get_results_from_db():
    url = "%s/results?build_tag=%s" % (ft_utils.get_db_url(),
                                       CONST.BUILD_TAG)
    logger.debug("Query to rest api: %s" % url)
    try:
        data = json.load(urllib2.urlopen(url))
        return data['results']
    except:
        logger.error("Cannot read content from the url: %s" % url)
        return None
Exemple #4
0
 def getdefaultpara(self):
     """
     Get Default Parameters value
     """
     self.Result_DB = str(ft_utils.get_db_url())
     self.masterusername = str(ft_constants.ONOSBENCH_USERNAME)
     self.masterpassword = str(ft_constants.ONOSBENCH_PASSWORD)
     self.agentusername = str(ft_constants.ONOSCLI_USERNAME)
     self.agentpassword = str(ft_constants.ONOSCLI_PASSWORD)
     self.runtimeout = ft_constants.ONOS_RUNTIMEOUT
     self.OCT = str(ft_constants.ONOS_OCT)
     self.OC1 = str(ft_constants.ONOS_OC1)
     self.OC2 = str(ft_constants.ONOS_OC2)
     self.OC3 = str(ft_constants.ONOS_OC3)
     self.OCN = str(ft_constants.ONOS_OCN)
     self.OCN2 = str(ft_constants.ONOS_OCN2)
     self.installer_master = str(ft_constants.ONOS_INSTALLER_MASTER)
     self.installer_master_username = \
         str(ft_constants.ONOS_INSTALLER_MASTER_USERNAME)
     self.installer_master_password = \
         ft_constants.ONOS_INSTALLER_MASTER_PASSWORD
     self.hosts = [self.OC1, self.OCN, self.OCN2]
     self.localhost = self.OCT
Exemple #5
0
 def getdefaultpara(self):
     """
     Get Default Parameters value
     """
     self.Result_DB = ft_utils.get_db_url()
     self.masterusername = CONST.ONOS_onosbench_username
     self.masterpassword = CONST.ONOS_onosbench_password
     self.agentusername = CONST.ONOS_onoscli_username
     self.agentpassword = CONST.ONOS_onoscli_password
     self.runtimeout = CONST.ONOS_runtimeout
     self.OCT = CONST.ONOS_environment_OCT
     self.OC1 = CONST.ONOS_environment_OC1
     self.OC2 = CONST.ONOS_environment_OC2
     self.OC3 = CONST.ONOS_environment_OC3
     self.OCN = CONST.ONOS_environment_OCN
     self.OCN2 = CONST.ONOS_environment_OCN2
     self.installer_master = CONST.ONOS_environment_installer_master
     self.installer_master_username = (
         CONST.ONOS_environment_installer_master_username)
     self.installer_master_password = (
         CONST.ONOS_environment_installer_master_password)
     self.hosts = [self.OC1, self.OCN, self.OCN2]
     self.localhost = self.OCT
Exemple #6
0
 def test_get_results_from_db_success(self, mock_method):
     url = "%s/results?build_tag=%s" % (ft_utils.get_db_url(),
                                        CONST.BUILD_TAG)
     self.assertEqual(gen_report.get_results_from_db(), None)
     mock_method.assert_called_once_with(url)
 def test_get_db_url_default(self, mock_get_functest_config):
     mock_get_functest_config.return_value = self.db_url
     self.assertEqual(functest_utils.get_db_url(), self.db_url)
     mock_get_functest_config.assert_called_once_with('results.test_db_url')