def test_update_error_verify(client, test_repository, text_log_errors_failure_lines, classified_failures, test_user): text_log_errors, failure_lines = text_log_errors_failure_lines client.force_authenticate(user=test_user) failure_line = failure_lines[0] error_line = text_log_errors[0] assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified is False assert error_line.metadata.failure_line == failure_line assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified is False body = {"best_classification": classified_failures[0].id} resp = client.put( reverse("text-log-error-detail", kwargs={"pk": error_line.id}), body) assert resp.status_code == 200 failure_line.refresh_from_db() error_line.metadata.refresh_from_db() assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified es_line = _TestFailureLine.get(failure_line.id, routing=failure_line.test) assert es_line.best_classification == classified_failures[0].id assert es_line.best_is_verified
def test_update_failure_line_verify(test_repository, failure_lines, classified_failures, test_user): client = APIClient() client.force_authenticate(user=test_user) failure_line = failure_lines[0] assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified is False body = { "project": test_repository.name, "best_classification": classified_failures[0].id } resp = client.put(reverse("failure-line-detail", kwargs={"pk": failure_line.id}), body, format="json") assert resp.status_code == 200 failure_line.refresh_from_db() assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified es_line = TestFailureLine.get(failure_line.id, routing=failure_line.test) assert es_line.best_classification == classified_failures[0].id assert es_line.best_is_verified
def test_store_error_summary_elastic_search(activate_responses, test_repository, test_job, elasticsearch): log_path = SampleData().get_log_path("plain-chunked_errorsummary.log") log_url = 'http://my-log.mozilla.org' with open(log_path) as log_handler: responses.add(responses.GET, log_url, body=log_handler.read(), status=200) log_obj = JobLog.objects.create(job=test_job, name="errorsummary_json", url=log_url) store_failure_lines(log_obj) assert FailureLine.objects.count() == 1 failure = FailureLine.objects.get(pk=1) es_line = _TestFailureLine.get(1, routing=failure.test) for prop in ["test", "subtest", "status", "expected"]: assert getattr(es_line, prop) == getattr(failure, prop) assert es_line.best_classification is None assert es_line.best_is_verified is False
def test_update_failure_line_verify(eleven_jobs_stored, jm, failure_lines, classified_failures, test_user): client = APIClient() client.force_authenticate(user=test_user) failure_line = failure_lines[0] assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified is False body = {"project": jm.project, "best_classification": classified_failures[0].id} resp = client.put( reverse("failure-line-detail", kwargs={"pk": failure_line.id}), body, format="json") assert resp.status_code == 200 failure_line.refresh_from_db() assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified es_line = TestFailureLine.get(failure_line.id, routing=failure_line.test) assert es_line.best_classification == classified_failures[0].id assert es_line.best_is_verified
def test_update_error_verify_bug(test_repository, text_log_errors_failure_lines, classified_failures, test_user): MatcherManager.register_detector(ManualDetector) text_log_errors, failure_lines = text_log_errors_failure_lines client = APIClient() client.force_authenticate(user=test_user) failure_line = failure_lines[0] error_line = text_log_errors[0] assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified is False assert error_line.metadata.failure_line == failure_line assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified is False classified_failures[0].bug_number = 1234 classified_failures[0].save() body = {"bug_number": classified_failures[0].bug_number} resp = client.put( reverse("text-log-error-detail", kwargs={"pk": error_line.id}), body, format="json") assert resp.status_code == 200 failure_line.refresh_from_db() error_line.metadata.refresh_from_db() assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified es_line = _TestFailureLine.get(failure_line.id, routing=failure_line.test) assert es_line.best_classification == classified_failures[0].id assert es_line.best_is_verified
def test_update_error_verify_bug(test_repository, text_log_errors_failure_lines, classified_failures, test_user): MatcherManager.register_detector(ManualDetector) text_log_errors, failure_lines = text_log_errors_failure_lines client = APIClient() client.force_authenticate(user=test_user) failure_line = failure_lines[0] error_line = text_log_errors[0] assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified is False assert error_line.metadata.failure_line == failure_line assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified is False classified_failures[0].bug_number = 1234 classified_failures[0].save() body = {"bug_number": classified_failures[0].bug_number} resp = client.put( reverse("text-log-error-detail", kwargs={"pk": error_line.id}), body, format="json") assert resp.status_code == 200 failure_line.refresh_from_db() error_line.metadata.refresh_from_db() assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified es_line = _TestFailureLine.get(failure_line.id, routing=failure_line.test) assert es_line.best_classification == classified_failures[0].id assert es_line.best_is_verified
def test_update_failure_line_verify(test_repository, text_log_errors_failure_lines, classified_failures, test_user): text_log_errors, failure_lines = text_log_errors_failure_lines client = APIClient() client.force_authenticate(user=test_user) failure_line = failure_lines[0] error_line = text_log_errors[0] assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified is False assert error_line.metadata.failure_line == failure_line assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified is False body = {"project": test_repository.name, "best_classification": classified_failures[0].id} resp = client.put( reverse("failure-line-detail", kwargs={"pk": failure_line.id}), body, format="json") assert resp.status_code == 200 failure_line.refresh_from_db() error_line.metadata.refresh_from_db() error_line.refresh_from_db() assert failure_line.best_classification == classified_failures[0] assert failure_line.best_is_verified assert error_line.metadata.best_classification == classified_failures[0] assert error_line.metadata.best_is_verified es_line = _TestFailureLine.get(failure_line.id, routing=failure_line.test) assert es_line.best_classification == classified_failures[0].id assert es_line.best_is_verified
def test_store_error_summary_elastic_search(activate_responses, test_repository, test_job, elasticsearch): log_path = SampleData().get_log_path("plain-chunked_errorsummary.log") log_url = 'http://my-log.mozilla.org' with open(log_path) as log_handler: responses.add(responses.GET, log_url, body=log_handler.read(), status=200) log_obj = JobLog.objects.create(job=test_job, name="errorsummary_json", url=log_url) store_failure_lines(log_obj) assert FailureLine.objects.count() == 1 failure = FailureLine.objects.get(pk=1) es_line = _TestFailureLine.get(1, routing=failure.test) for prop in ["test", "subtest", "status", "expected"]: assert getattr(es_line, prop) == getattr(failure, prop) assert es_line.best_classification is None assert es_line.best_is_verified is False