Fix test_queries regression
In change Ic6f115a6882494bf4c087ded4d7cafa557765c28, test_queries.py was not updated to use the new Config class. It causes the non-voting test to fail for the 'wrong' reasons. Change-Id: Ib729d5d360619bf289bc9c91f2a3f856f525a947
This commit is contained in:
parent
9104509e18
commit
f4ddadc834
@ -25,6 +25,8 @@ DB_URI = 'mysql+pymysql://query:query@logstash.openstack.org/subunit2sql'
|
||||
JOBS_RE = '(tempest-dsvm-full|gate-tempest-dsvm-virtual-ironic)'
|
||||
CI_USERNAME = 'jenkins'
|
||||
|
||||
GERRIT_QUERY_FILE = 'queries'
|
||||
|
||||
PID_FN = '/var/run/elastic-recheck/elastic-recheck.pid'
|
||||
|
||||
# Not all teams actively used elastic recheck for categorizing their
|
||||
@ -69,7 +71,8 @@ class Config(object):
|
||||
all_fails_query=None,
|
||||
excluded_jobs_regex=None,
|
||||
included_projects_regex=None,
|
||||
uncat_search_size=None):
|
||||
uncat_search_size=None,
|
||||
gerrit_query_file=None):
|
||||
|
||||
self.es_url = es_url or ES_URL
|
||||
self.ls_url = ls_url or LS_URL
|
||||
@ -85,6 +88,7 @@ class Config(object):
|
||||
self.included_projects_regex = \
|
||||
included_projects_regex or INCLUDED_PROJECTS_REGEX
|
||||
self.uncat_search_size = uncat_search_size or UNCAT_MAX_SEARCH_SIZE
|
||||
self.gerrit_query_file = gerrit_query_file or GERRIT_QUERY_FILE
|
||||
|
||||
if config_file or config_obj:
|
||||
if config_obj:
|
||||
@ -99,6 +103,7 @@ class Config(object):
|
||||
'jobs_regex': JOBS_RE,
|
||||
'pidfile': PID_FN,
|
||||
'index_format': DEFAULT_INDEX_FORMAT,
|
||||
'query_file': GERRIT_QUERY_FILE,
|
||||
}
|
||||
)
|
||||
config.read(config_file)
|
||||
|
@ -14,10 +14,10 @@
|
||||
|
||||
import os
|
||||
|
||||
import ConfigParser
|
||||
from launchpadlib import launchpad
|
||||
import pyelasticsearch
|
||||
|
||||
import elastic_recheck.config as er_conf
|
||||
from elastic_recheck import elasticRecheck
|
||||
import elastic_recheck.query_builder as qb
|
||||
from elastic_recheck import tests
|
||||
@ -35,23 +35,9 @@ class TestQueries(tests.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestQueries, self).setUp()
|
||||
config = ConfigParser.ConfigParser({'server_password': None})
|
||||
config.read('elasticRecheck.conf')
|
||||
if config.has_section('data_source'):
|
||||
es_url = config.get('data_source', 'es_url')
|
||||
db_uri = config.get('data_source', 'db_uri')
|
||||
else:
|
||||
es_url = None
|
||||
db_uri = None
|
||||
|
||||
if config.has_section('gerrit'):
|
||||
self.queries = config.get('gerrit', 'query_file')
|
||||
else:
|
||||
self.queries = 'queries'
|
||||
|
||||
self.classifier = elasticRecheck.Classifier(self.queries,
|
||||
es_url=es_url,
|
||||
db_uri=db_uri)
|
||||
config = er_conf.Config(config_file='elasticRecheck.conf')
|
||||
self.classifier = elasticRecheck.Classifier(config.gerrit_query_file,
|
||||
config=config)
|
||||
|
||||
self.lp = launchpad.Launchpad.login_anonymously('grabbing bugs',
|
||||
'production',
|
||||
|
Loading…
Reference in New Issue
Block a user