зеркало из https://github.com/mozilla/treeherder.git
Order PerformanceDatum related data for PostgreSQL tests
This commit is contained in:
Родитель
ccae22a247
Коммит
03c67cbbbd
|
@ -1,7 +1,6 @@
|
||||||
import copy
|
import copy
|
||||||
import pytest
|
import pytest
|
||||||
import datetime
|
import datetime
|
||||||
from django.conf import settings
|
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
@ -482,10 +481,6 @@ def test_filter_data_by_signature(
|
||||||
assert resp.data[signature.signature_hash][0]['value'] == float(i)
|
assert resp.data[signature.signature_hash][0]['value'] == float(i)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
settings.DATABASES['default']['ENGINE'] != 'django.db.backends.mysql',
|
|
||||||
reason='Fails frequently with PostgreSQL',
|
|
||||||
)
|
|
||||||
def test_perf_summary(client, test_perf_signature, test_perf_data):
|
def test_perf_summary(client, test_perf_signature, test_perf_data):
|
||||||
query_params1 = (
|
query_params1 = (
|
||||||
'?repository={}&framework={}&interval=172800&no_subtests=true&revision={}'.format(
|
'?repository={}&framework={}&interval=172800&no_subtests=true&revision={}'.format(
|
||||||
|
@ -533,10 +528,6 @@ def test_perf_summary(client, test_perf_signature, test_perf_data):
|
||||||
assert resp2.json() == expected
|
assert resp2.json() == expected
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
settings.DATABASES['default']['ENGINE'] != 'django.db.backends.mysql',
|
|
||||||
reason='Fails frequently with PostgreSQL',
|
|
||||||
)
|
|
||||||
def test_data_points_from_same_push_are_ordered_chronologically(
|
def test_data_points_from_same_push_are_ordered_chronologically(
|
||||||
client, test_perf_signature, test_perf_data
|
client, test_perf_signature, test_perf_data
|
||||||
):
|
):
|
||||||
|
@ -720,10 +711,6 @@ def test_filter_out_retriggers():
|
||||||
assert filtered_data == no_retriggers_data
|
assert filtered_data == no_retriggers_data
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
settings.DATABASES['default']['ENGINE'] != 'django.db.backends.mysql',
|
|
||||||
reason='Fails with PostgreSQL',
|
|
||||||
)
|
|
||||||
def test_alert_summary_tasks_get(client, test_perf_alert_summary, test_perf_data):
|
def test_alert_summary_tasks_get(client, test_perf_alert_summary, test_perf_data):
|
||||||
create_perf_alert(
|
create_perf_alert(
|
||||||
summary=test_perf_alert_summary,
|
summary=test_perf_alert_summary,
|
||||||
|
@ -738,9 +725,9 @@ def test_alert_summary_tasks_get(client, test_perf_alert_summary, test_perf_data
|
||||||
assert resp.json() == {
|
assert resp.json() == {
|
||||||
"id": test_perf_alert_summary.id,
|
"id": test_perf_alert_summary.id,
|
||||||
"tasks": [
|
"tasks": [
|
||||||
"Mochitest Browser Chrome",
|
|
||||||
"Inari Device Image Build",
|
|
||||||
"B2G Emulator Image Build",
|
"B2G Emulator Image Build",
|
||||||
|
"Inari Device Image Build",
|
||||||
|
"Mochitest Browser Chrome",
|
||||||
"Nexus 4 Device Image Build",
|
"Nexus 4 Device Image Build",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -676,8 +676,10 @@ class PerformanceSummary(generics.ListAPIView):
|
||||||
|
|
||||||
signature_ids = [item['id'] for item in list(self.queryset)]
|
signature_ids = [item['id'] for item in list(self.queryset)]
|
||||||
|
|
||||||
data = PerformanceDatum.objects.select_related('push', 'repository', 'id').filter(
|
data = (
|
||||||
signature_id__in=signature_ids, repository__name=repository_name
|
PerformanceDatum.objects.select_related('push', 'repository', 'id')
|
||||||
|
.filter(signature_id__in=signature_ids, repository__name=repository_name)
|
||||||
|
.order_by('job_id', 'id')
|
||||||
)
|
)
|
||||||
|
|
||||||
if revision:
|
if revision:
|
||||||
|
@ -784,6 +786,7 @@ class PerformanceAlertSummaryTasks(generics.ListAPIView):
|
||||||
tasks = (
|
tasks = (
|
||||||
PerformanceDatum.objects.filter(signature__in=signature_ids)
|
PerformanceDatum.objects.filter(signature__in=signature_ids)
|
||||||
.values_list('job__job_type__name', flat=True)
|
.values_list('job__job_type__name', flat=True)
|
||||||
|
.order_by("job__job_type__name")
|
||||||
.distinct()
|
.distinct()
|
||||||
)
|
)
|
||||||
self.queryset = {"id": alert_summary_id, "tasks": tasks}
|
self.queryset = {"id": alert_summary_id, "tasks": tasks}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче