Bug 1329002 - Remove misleading TREEHERDER_TEST_PROJECT constant

This naming was a relic of the old datasource code we were using. For
the most part, we don't need it. Where we do need it, we should call it
what it is: a repository name.
This commit is contained in:
William Lachance 2017-01-06 14:32:06 -05:00 коммит произвёл William Lachance
Родитель 012df34580
Коммит 06c27becd1
7 изменённых файлов: 10 добавлений и 40 удалений

Просмотреть файл

@ -91,7 +91,7 @@ def test_repository(transactional_db):
r = Repository.objects.create(
dvcs_type="hg",
name=settings.TREEHERDER_TEST_PROJECT,
name=settings.TREEHERDER_TEST_REPOSITORY_NAME,
url="https://hg.mozilla.org/mozilla-central",
active_status="active",
codebase="gecko",

Просмотреть файл

@ -3,8 +3,7 @@ import copy
import pytest
from tests import test_utils
from tests.sample_data_generator import (job_data,
result_set)
from tests.sample_data_generator import job_data
from treeherder.etl.jobs import (_get_lower_tier_signatures,
_remove_existing_jobs,
store_job_data)
@ -211,16 +210,15 @@ def test_ingest_retry_sample_job_no_running(test_repository,
def test_bad_date_value_ingestion(test_repository, failure_classifications,
mock_log_parser):
sample_resultset, mock_log_parser):
"""
Test ingesting a job blob with bad date value
"""
rs = result_set()
blob = job_data(start_timestamp="foo",
revision=rs['revision'])
revision=sample_resultset[0]['revision'])
store_result_set_data(test_repository, [rs])
store_result_set_data(test_repository, sample_resultset[:1])
store_job_data(test_repository, [blob])
# if no exception, we are good.

Просмотреть файл

@ -2,7 +2,6 @@ import json
import os
import responses
from django.conf import settings
from django.core.cache import cache
from treeherder.etl.pushlog import HgPushlogProcess
@ -99,7 +98,7 @@ def test_ingest_hg_pushlog_cache_last_push(test_repository,
pushes = pushlog_dict['pushes']
max_push_id = max([int(k) for k in pushes.keys()])
cache_key = "%s:last_push_id" % settings.TREEHERDER_TEST_PROJECT
cache_key = "{}:last_push_id".format(test_repository.name)
assert cache.get(cache_key) == max_push_id

Просмотреть файл

@ -2,13 +2,9 @@
Functions for flexible generation of sample input job JSON.
"""
import json
import os
import time
from datetime import timedelta
from django.conf import settings
def job_data(**kwargs):
jobs_obj = {
@ -139,26 +135,3 @@ def machine_platform(**kwargs):
defaults.update(kwargs)
return defaults
def result_set(**kwargs):
"""
Return a sample result set, with default values.
"""
source_file = os.path.join(
os.path.dirname(__file__),
"sample_data",
"resultset_data.json"
)
with open(source_file) as f:
defaults = json.load(f)[0]
defaults.update(kwargs)
# ensure that the repository values for all the revisions have the
# same name as the db test name in settings. If this is not
# the same, the tests will not pass.
for rev in defaults["revisions"]:
rev["repository"] = settings.TREEHERDER_TEST_PROJECT
return defaults

Просмотреть файл

@ -71,7 +71,7 @@ class SampleData(object):
# the same, the tests will not pass.
for rs in self.resultset_data:
for rev in rs["revisions"]:
rev["repository"] = settings.TREEHERDER_TEST_PROJECT
rev["repository"] = settings.TREEHERDER_TEST_REPOSITORY_NAME
def get_log_path(self, name):
"""Returns the full path to a log file"""

Просмотреть файл

@ -1,7 +1,8 @@
from treeherder.config.settings import *
DATABASES["default"]["TEST"] = {"NAME": "test_treeherder"}
TREEHERDER_TEST_PROJECT = "%s_jobs" % DATABASES["default"]["TEST"]["NAME"]
TREEHERDER_TEST_REPOSITORY_NAME = 'test_treeherder_jobs'
# this makes celery calls synchronous, useful for unit testing
CELERY_ALWAYS_EAGER = True

Просмотреть файл

@ -1,7 +1,6 @@
import datetime
import pytest
from django.conf import settings
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from rest_framework.test import APIClient
@ -16,7 +15,7 @@ def test_repository_onhold(transactional_db):
r = Repository.objects.create(
dvcs_type="hg",
name=settings.TREEHERDER_TEST_PROJECT + "_test_onhold",
name="treeherder_test_onhold",
url="https://hg.mozilla.org/mozilla-central",
active_status="onhold",
codebase="gecko",