From a3af89f2b82eba51c5760aee559680de30ce6721 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Fri, 10 Apr 2015 12:29:21 +0100 Subject: [PATCH] Bug 1153186 - Rename OrangeFactorRequest BugzillaBugRequest 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/ --- tests/etl/test_classification_mirroring.py | 9 ++++----- treeherder/etl/classification_mirroring.py | 4 ++-- treeherder/etl/tasks/classification_mirroring_tasks.py | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/etl/test_classification_mirroring.py b/tests/etl/test_classification_mirroring.py index 82ecd734bf0..b18b0140d61 100644 --- a/tests/etl/test_classification_mirroring.py +++ b/tests/etl/test_classification_mirroring.py @@ -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): @@ -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 = { @@ -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 = { @@ -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 diff --git a/treeherder/etl/classification_mirroring.py b/treeherder/etl/classification_mirroring.py index 12037e347de..ea76f06d8ae 100644 --- a/treeherder/etl/classification_mirroring.py +++ b/treeherder/etl/classification_mirroring.py @@ -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 @@ -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 diff --git a/treeherder/etl/tasks/classification_mirroring_tasks.py b/treeherder/etl/tasks/classification_mirroring_tasks.py index 4a3b57146d6..45340a5ad5a 100644 --- a/treeherder/etl/tasks/classification_mirroring_tasks.py +++ b/treeherder/etl/tasks/classification_mirroring_tasks.py @@ -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) @@ -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: @@ -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: