Skip to content

Commit

Permalink
Add application field
Browse files Browse the repository at this point in the history
  • Loading branch information
beatrice-acasandrei committed Aug 28, 2023
1 parent 913260c commit 3694af9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def create(
test,
test_perf_signature,
repository,
application='',
):
return perf_models.PerformanceSignature.objects.create(
repository=repository,
Expand All @@ -160,6 +161,7 @@ def create(
extra_options=extra_options,
last_updated=datetime.datetime.now(),
measurement_unit=measurement_unit,
application=application,
)

return create
Expand Down
16 changes: 16 additions & 0 deletions tests/webapp/api/test_perfcompare_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def test_perfcompare_results_against_no_base(
test = 'dhtml.html'
extra_options = 'e10s fission stylo webrender'
measurement_unit = 'ms'
base_application = 'firefox'
new_application = 'geckoview'

base_sig = create_signature(
signature_hash=(20 * 't1'),
Expand All @@ -49,6 +51,7 @@ def test_perfcompare_results_against_no_base(
test=test,
test_perf_signature=test_perf_signature,
repository=try_repository,
application=base_application,
)

base_perf_data_values = [32.4]
Expand Down Expand Up @@ -77,6 +80,7 @@ def test_perfcompare_results_against_no_base(
test=test,
test_perf_signature=test_perf_signature,
repository=test_repository,
application=new_application,
)

job = perf_jobs[1]
Expand Down Expand Up @@ -108,6 +112,8 @@ def test_perfcompare_results_against_no_base(
'header_name': response['header_name'],
'base_repository_name': base_sig.repository.name,
'new_repository_name': new_sig.repository.name,
'base_application': 'firefox',
'new_application': 'geckoview',
'is_complete': response['is_complete'],
'base_measurement_unit': base_sig.measurement_unit,
'new_measurement_unit': new_sig.measurement_unit,
Expand Down Expand Up @@ -188,6 +194,8 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
test = 'dhtml.html'
extra_options = 'e10s fission stylo webrender'
measurement_unit = 'ms'
base_application = 'firefox'
new_application = 'geckoview'

base_sig = create_signature(
signature_hash=(20 * 't1'),
Expand All @@ -198,6 +206,7 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
test=test,
test_perf_signature=test_perf_signature,
repository=try_repository,
application=base_application,
)

base_perf_data_values = [32.4]
Expand Down Expand Up @@ -226,6 +235,7 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
test=test,
test_perf_signature=test_perf_signature,
repository=test_repository,
application=new_application,
)

job = perf_jobs[1]
Expand Down Expand Up @@ -257,6 +267,8 @@ def test_perfcompare_results_with_only_one_run_and_diff_repo(
'header_name': response['header_name'],
'base_repository_name': base_sig.repository.name,
'new_repository_name': new_sig.repository.name,
'base_application': 'firefox',
'new_application': 'geckoview',
'is_complete': response['is_complete'],
'base_measurement_unit': base_sig.measurement_unit,
'new_measurement_unit': new_sig.measurement_unit,
Expand Down Expand Up @@ -413,6 +425,8 @@ def test_perfcompare_results_multiple_runs(
'header_name': first_row['header_name'],
'base_repository_name': sig1.repository.name,
'new_repository_name': sig2.repository.name,
'base_application': '',
'new_application': '',
'is_complete': first_row['is_complete'],
'base_measurement_unit': sig1.measurement_unit,
'new_measurement_unit': sig2.measurement_unit,
Expand Down Expand Up @@ -457,6 +471,8 @@ def test_perfcompare_results_multiple_runs(
'header_name': second_row['header_name'],
'base_repository_name': sig3.repository.name,
'new_repository_name': sig4.repository.name,
'base_application': '',
'new_application': '',
'is_complete': second_row['is_complete'],
'base_measurement_unit': sig3.measurement_unit,
'new_measurement_unit': sig4.measurement_unit,
Expand Down
6 changes: 6 additions & 0 deletions treeherder/webapp/api/performance_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ def list(self, request):
new_is_better, base_avg_value, new_avg_value, confidence
)

base_application = base_sig.get('application', '')
new_application = new_sig.get('application', '')

is_improvement = class_name == 'success'
is_regression = class_name == 'danger'
is_meaningful = class_name == ''
Expand All @@ -928,6 +931,8 @@ def list(self, request):
'new_rev': new_rev,
'header_name': header,
'platform': platform,
'base_application': base_application,
'new_application': new_application,
'suite': base_sig.get('suite', ''), # same suite for base_result and new_result
'test': base_sig.get('test', ''), # same test for base_result and new_result
'is_complete': is_complete,
Expand Down Expand Up @@ -1113,6 +1118,7 @@ def _get_signatures_values(signatures: List[PerformanceSignature]):
'measurement_unit',
'lower_is_better',
'signature_hash',
'application',
)

@staticmethod
Expand Down
14 changes: 14 additions & 0 deletions treeherder/webapp/api/performance_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,18 @@ def validate(self, data):
class PerfCompareResultsSerializer(serializers.ModelSerializer):
base_rev = serializers.CharField()
new_rev = serializers.CharField()
base_application = serializers.CharField(
# max_length=10,
default='',
# help_text="Application that runs the signature's tests. "
# "Generally used to record browser's name, but not necessarily.",
)
new_application = serializers.CharField(
# max_length=10,
default='',
# help_text="Application that runs the signature's tests. "
# "Generally used to record browser's name, but not necessarily.",
)
is_empty = serializers.BooleanField()
is_complete = serializers.BooleanField()
platform = serializers.CharField()
Expand Down Expand Up @@ -489,6 +501,8 @@ class Meta:
fields = [
'base_rev',
'new_rev',
'base_application',
'new_application',
'framework_id',
'platform',
'suite',
Expand Down

0 comments on commit 3694af9

Please sign in to comment.