Skip to content

Commit

Permalink
Bug 1153186 - Rename OrangeFactorRequest BugzillaBugRequest
Browse files Browse the repository at this point in the history
We're submitting to Elasticsearch (used by OrangeFactor), not directly
to OrangeFactor, so "Elasticsearch" is more appropriate. The use of
"Bug" in the name makes it sound like we're submitting a bug, which
we're not, we're submitting a bug comment (or ES doc) which contains a
number of different fields, in response to a classification entry made a
sheriff iff the classification included a bug number, which is slightly
different, and too nuanced to include in the name.

As such whilst not perfect, I think this is slightly clearer:
s/OrangeFactorRequest/ElasticsearchDocRequest/
and
s/BugzillaBugRequest/BugzillaCommentRequest/
  • Loading branch information
Ed Morley committed Apr 13, 2015
1 parent 8c836a9 commit a3af89f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions tests/etl/test_classification_mirroring.py
Expand Up @@ -7,7 +7,7 @@
from datadiff import diff

from django.conf import settings
from treeherder.etl.classification_mirroring import OrangeFactorBugRequest, BugzillaBugRequest
from treeherder.etl.classification_mirroring import ElasticsearchDocRequest, BugzillaCommentRequest


def test_tbpl_bug_request_body(jm, eleven_jobs_processed):
Expand All @@ -29,8 +29,7 @@ def test_tbpl_bug_request_body(jm, eleven_jobs_processed):
submit_timestamp = int(time())
who = "user@mozilla.com"

req = OrangeFactorBugRequest(jm.project, job_id,
bug_id, submit_timestamp, who)
req = ElasticsearchDocRequest(jm.project, job_id, bug_id, submit_timestamp, who)
req.generate_request_body()

expected = {
Expand Down Expand Up @@ -72,7 +71,7 @@ def test_tbpl_bugzilla_request_body(jm, eleven_jobs_processed):
]

jm.store_job_artifact([bug_suggestions_placeholders])
req = BugzillaBugRequest(jm.project, job_id, bug_id, who)
req = BugzillaCommentRequest(jm.project, job_id, bug_id, who)
req.generate_request_body()

expected = {
Expand Down Expand Up @@ -112,7 +111,7 @@ def test_tbpl_bugzilla_comment_length_capped(jm, eleven_jobs_processed):
]

jm.store_job_artifact([bug_suggestions_placeholders])
req = BugzillaBugRequest(jm.project, job_id, bug_id, who)
req = BugzillaCommentRequest(jm.project, job_id, bug_id, who)
req.generate_request_body()

assert len(req.body['comment']) == settings.BZ_MAX_COMMENT_LENGTH
4 changes: 2 additions & 2 deletions treeherder/etl/classification_mirroring.py
Expand Up @@ -13,7 +13,7 @@
logger = logging.getLogger(__name__)


class OrangeFactorBugRequest(object):
class ElasticsearchDocRequest(object):

def __init__(self, project, job_id, bug_id, submit_timestamp, who):
self.project = project
Expand Down Expand Up @@ -82,7 +82,7 @@ def send_request(self):
raise


class BugzillaBugRequest(object):
class BugzillaCommentRequest(object):

def __init__(self, project, job_id, bug_id, who):
self.project = project
Expand Down
6 changes: 3 additions & 3 deletions treeherder/etl/tasks/classification_mirroring_tasks.py
Expand Up @@ -6,7 +6,7 @@
This module contains
"""
from celery import task
from treeherder.etl.classification_mirroring import OrangeFactorBugRequest, BugzillaBugRequest
from treeherder.etl.classification_mirroring import ElasticsearchDocRequest, BugzillaCommentRequest


@task(name="submit-star-comment", max_retries=10, time_limit=30)
Expand All @@ -16,7 +16,7 @@ def submit_star_comment(project, job_id, bug_id, submit_timestamp, who):
starcomment.php proxies then the request to orange factor
"""
try:
req = OrangeFactorBugRequest(project, job_id, bug_id, submit_timestamp, who)
req = ElasticsearchDocRequest(project, job_id, bug_id, submit_timestamp, who)
req.generate_request_body()
req.send_request()
except Exception as e:
Expand All @@ -35,7 +35,7 @@ def submit_bug_comment(project, job_id, bug_id, who):
to add a new comment to the associated bug on bugzilla.
"""
try:
req = BugzillaBugRequest(project, job_id, bug_id, who)
req = BugzillaCommentRequest(project, job_id, bug_id, who)
req.generate_request_body()
req.send_request()
except Exception as e:
Expand Down

0 comments on commit a3af89f

Please sign in to comment.