Skip to content

Commit 5862c32

Browse files
committed
feat: use new CAs with commits failed fixed
the "commits failed” field on the CAs previously failed to deduplicate commits that failed across days so if commit A failed yesterday and today it would count for 2 commits failed, the new CAs fix this so we want to consume information from them instead of the old ones. This commit also reorganizes the timescale aggregation code in the GQL API and checks the is_called_from_sentry_app function to decide which version of the aggregation to use
1 parent 87c2872 commit 5862c32

16 files changed

+864
-915
lines changed
Lines changed: 66 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[
22
{
3-
"computed_name": "name0",
4-
"testsuite": "testsuite0",
3+
"test_id": "0d312f0fe886f107f94fc93991e2dc87",
54
"total_pass_count": 1,
65
"total_fail_count": 0,
76
"total_flaky_fail_count": 0,
@@ -10,37 +9,61 @@
109
"total_count": 1.0,
1110
"failure_rate": 0.0,
1211
"flake_rate": 0.0,
13-
"total_duration": 0.0,
14-
"avg_duration": 0.0,
15-
"last_duration": 0.0,
12+
"total_duration": 2.0,
13+
"avg_duration": 2.0,
14+
"last_duration": 2.0,
15+
"last_outcome": "pass",
1616
"flags": [
1717
"flag1",
1818
"flag2"
1919
],
20-
"name": "name0"
20+
"computed_name": "name2",
21+
"name": "name2",
22+
"testsuite": "testsuite2"
2123
},
2224
{
23-
"computed_name": "name1",
24-
"testsuite": "testsuite1",
25+
"test_id": "16828e614f0b139492d77d5c70d7ecc4",
2526
"total_pass_count": 0,
26-
"total_fail_count": 1,
27+
"total_fail_count": 0,
28+
"total_flaky_fail_count": 0,
29+
"total_skip_count": 1,
30+
"commits_where_fail": 0,
31+
"total_count": 0.0,
32+
"failure_rate": 0.0,
33+
"flake_rate": 0.0,
34+
"total_duration": 0.0,
35+
"avg_duration": 0.0,
36+
"last_duration": 0.0,
37+
"last_outcome": "skip",
38+
"flags": null,
39+
"computed_name": "name5",
40+
"name": "name5",
41+
"testsuite": "testsuite5"
42+
},
43+
{
44+
"test_id": "3158ae556dccb76c50517a257d96886b",
45+
"total_pass_count": 1,
46+
"total_fail_count": 0,
2747
"total_flaky_fail_count": 0,
2848
"total_skip_count": 0,
29-
"commits_where_fail": 1,
49+
"commits_where_fail": 0,
3050
"total_count": 1.0,
31-
"failure_rate": 1.0,
51+
"failure_rate": 0.0,
3252
"flake_rate": 0.0,
33-
"total_duration": 1.0,
34-
"avg_duration": 1.0,
35-
"last_duration": 1.0,
53+
"total_duration": 4.0,
54+
"avg_duration": 4.0,
55+
"last_duration": 4.0,
56+
"last_outcome": "pass",
3657
"flags": [
37-
"flag3"
58+
"flag1",
59+
"flag2"
3860
],
39-
"name": "name1"
61+
"computed_name": "name4",
62+
"name": "name4",
63+
"testsuite": "testsuite4"
4064
},
4165
{
42-
"computed_name": "name2",
43-
"testsuite": "testsuite2",
66+
"test_id": "8817e9110bb1682219b3815ebf02430d",
4467
"total_pass_count": 1,
4568
"total_fail_count": 0,
4669
"total_flaky_fail_count": 0,
@@ -49,18 +72,20 @@
4972
"total_count": 1.0,
5073
"failure_rate": 0.0,
5174
"flake_rate": 0.0,
52-
"total_duration": 2.0,
53-
"avg_duration": 2.0,
54-
"last_duration": 2.0,
75+
"total_duration": 0.0,
76+
"avg_duration": 0.0,
77+
"last_duration": 0.0,
78+
"last_outcome": "pass",
5579
"flags": [
5680
"flag1",
5781
"flag2"
5882
],
59-
"name": "name2"
83+
"computed_name": "name0",
84+
"name": "name0",
85+
"testsuite": "testsuite0"
6086
},
6187
{
62-
"computed_name": "name3",
63-
"testsuite": "testsuite3",
88+
"test_id": "dce514d4d3d650ef6c1c34b68af89ec9",
6489
"total_pass_count": 0,
6590
"total_fail_count": 1,
6691
"total_flaky_fail_count": 0,
@@ -72,46 +97,33 @@
7297
"total_duration": 3.0,
7398
"avg_duration": 3.0,
7499
"last_duration": 3.0,
100+
"last_outcome": "failure",
75101
"flags": [
76102
"flag3"
77103
],
78-
"name": "name3"
104+
"computed_name": "name3",
105+
"name": "name3",
106+
"testsuite": "testsuite3"
79107
},
80108
{
81-
"computed_name": "name4",
82-
"testsuite": "testsuite4",
83-
"total_pass_count": 1,
84-
"total_fail_count": 0,
109+
"test_id": "ff20823eb233fba7e1b4ad1524fcb87e",
110+
"total_pass_count": 0,
111+
"total_fail_count": 1,
85112
"total_flaky_fail_count": 0,
86113
"total_skip_count": 0,
87-
"commits_where_fail": 0,
114+
"commits_where_fail": 1,
88115
"total_count": 1.0,
89-
"failure_rate": 0.0,
116+
"failure_rate": 1.0,
90117
"flake_rate": 0.0,
91-
"total_duration": 4.0,
92-
"avg_duration": 4.0,
93-
"last_duration": 4.0,
118+
"total_duration": 1.0,
119+
"avg_duration": 1.0,
120+
"last_duration": 1.0,
121+
"last_outcome": "failure",
94122
"flags": [
95-
"flag1",
96-
"flag2"
123+
"flag3"
97124
],
98-
"name": "name4"
99-
},
100-
{
101-
"computed_name": "name5",
102-
"testsuite": "testsuite5",
103-
"total_pass_count": 0,
104-
"total_fail_count": 0,
105-
"total_flaky_fail_count": 0,
106-
"total_skip_count": 1,
107-
"commits_where_fail": 0,
108-
"total_count": 0.0,
109-
"failure_rate": 0.0,
110-
"flake_rate": 0.0,
111-
"total_duration": 0.0,
112-
"avg_duration": 0.0,
113-
"last_duration": 0.0,
114-
"flags": null,
115-
"name": "name5"
125+
"computed_name": "name1",
126+
"name": "name1",
127+
"testsuite": "testsuite1"
116128
}
117129
]

apps/codecov-api/graphql_api/tests/snapshots/analytics_timescale__TestAnalyticsTestCaseNew__gql_query_test_results_timescale__0.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"totalCount": 6,
77
"edges": [
88
{
9-
"cursor": "NC4wfG5hbWU0",
9+
"cursor": "Ni4wfG5hbWU0",
1010
"node": {
1111
"name": "name4",
1212
"failureRate": 0.0,
1313
"flakeRate": 0.0,
14-
"avgDuration": 4.0,
15-
"totalDuration": 8.0,
14+
"avgDuration": 6.0,
15+
"totalDuration": 12.0,
1616
"totalFailCount": 0,
1717
"totalFlakyFailCount": 0,
1818
"totalPassCount": 2,
@@ -22,13 +22,13 @@
2222
}
2323
},
2424
{
25-
"cursor": "My4wfG5hbWUz",
25+
"cursor": "NC41fG5hbWUz",
2626
"node": {
2727
"name": "name3",
2828
"failureRate": 1.0,
2929
"flakeRate": 0.0,
30-
"avgDuration": 3.0,
31-
"totalDuration": 6.0,
30+
"avgDuration": 4.5,
31+
"totalDuration": 9.0,
3232
"totalFailCount": 2,
3333
"totalFlakyFailCount": 0,
3434
"totalPassCount": 0,
@@ -38,13 +38,13 @@
3838
}
3939
},
4040
{
41-
"cursor": "Mi4wfG5hbWUy",
41+
"cursor": "My4wfG5hbWUy",
4242
"node": {
4343
"name": "name2",
4444
"failureRate": 0.0,
4545
"flakeRate": 0.0,
46-
"avgDuration": 2.0,
47-
"totalDuration": 4.0,
46+
"avgDuration": 3.0,
47+
"totalDuration": 6.0,
4848
"totalFailCount": 0,
4949
"totalFlakyFailCount": 0,
5050
"totalPassCount": 2,
@@ -54,13 +54,13 @@
5454
}
5555
},
5656
{
57-
"cursor": "MS4wfG5hbWUx",
57+
"cursor": "MS41fG5hbWUx",
5858
"node": {
5959
"name": "name1",
6060
"failureRate": 1.0,
6161
"flakeRate": 0.0,
62-
"avgDuration": 1.0,
63-
"totalDuration": 2.0,
62+
"avgDuration": 1.5,
63+
"totalDuration": 3.0,
6464
"totalFailCount": 2,
6565
"totalFlakyFailCount": 0,
6666
"totalPassCount": 0,

apps/codecov-api/graphql_api/tests/snapshots/analytics_timescale__TestAnalyticsTestCaseNew__gql_query_test_results_timescale_non_precomputed_branch__0.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,67 @@
66
"totalCount": 5,
77
"edges": [
88
{
9-
"cursor": "NC4wfG5hbWU0",
9+
"cursor": "OC4wfG5hbWU0",
1010
"node": {
1111
"name": "name4",
1212
"failureRate": 0.0,
1313
"flakeRate": 0.0,
14-
"avgDuration": 4.0,
15-
"totalDuration": 4.0,
14+
"avgDuration": 8.0,
15+
"totalDuration": 8.0,
1616
"totalFailCount": 0,
1717
"totalFlakyFailCount": 0,
1818
"totalPassCount": 1,
1919
"totalSkipCount": 0,
2020
"commitsFailed": 0,
21-
"lastDuration": 4.0
21+
"lastDuration": 8.0
2222
}
2323
},
2424
{
25-
"cursor": "My4wfG5hbWUz",
25+
"cursor": "Ni4wfG5hbWUz",
2626
"node": {
2727
"name": "name3",
2828
"failureRate": 1.0,
2929
"flakeRate": 0.0,
30-
"avgDuration": 3.0,
31-
"totalDuration": 3.0,
30+
"avgDuration": 6.0,
31+
"totalDuration": 6.0,
3232
"totalFailCount": 1,
3333
"totalFlakyFailCount": 0,
3434
"totalPassCount": 0,
3535
"totalSkipCount": 0,
3636
"commitsFailed": 1,
37-
"lastDuration": 3.0
37+
"lastDuration": 6.0
3838
}
3939
},
4040
{
41-
"cursor": "Mi4wfG5hbWUy",
41+
"cursor": "NC4wfG5hbWUy",
4242
"node": {
4343
"name": "name2",
4444
"failureRate": 0.0,
4545
"flakeRate": 0.0,
46-
"avgDuration": 2.0,
47-
"totalDuration": 2.0,
46+
"avgDuration": 4.0,
47+
"totalDuration": 4.0,
4848
"totalFailCount": 0,
4949
"totalFlakyFailCount": 0,
5050
"totalPassCount": 1,
5151
"totalSkipCount": 0,
5252
"commitsFailed": 0,
53-
"lastDuration": 2.0
53+
"lastDuration": 4.0
5454
}
5555
},
5656
{
57-
"cursor": "MS4wfG5hbWUx",
57+
"cursor": "Mi4wfG5hbWUx",
5858
"node": {
5959
"name": "name1",
6060
"failureRate": 1.0,
6161
"flakeRate": 0.0,
62-
"avgDuration": 1.0,
63-
"totalDuration": 1.0,
62+
"avgDuration": 2.0,
63+
"totalDuration": 2.0,
6464
"totalFailCount": 1,
6565
"totalFlakyFailCount": 0,
6666
"totalPassCount": 0,
6767
"totalSkipCount": 0,
6868
"commitsFailed": 1,
69-
"lastDuration": 1.0
69+
"lastDuration": 2.0
7070
}
7171
},
7272
{

apps/codecov-api/graphql_api/tests/snapshots/analytics_timescale__TestAnalyticsTestCaseNew__gql_query_test_results_timescale_slowest_parameter__0.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
"totalCount": 1,
77
"edges": [
88
{
9-
"cursor": "NC4wfG5hbWU0",
9+
"cursor": "Ni4wfG5hbWU0",
1010
"node": {
1111
"name": "name4",
1212
"failureRate": 0.0,
1313
"flakeRate": 0.0,
14-
"avgDuration": 4.0,
15-
"totalDuration": 8.0,
14+
"avgDuration": 6.0,
15+
"totalDuration": 12.0,
1616
"totalFailCount": 0,
1717
"totalFlakyFailCount": 0,
1818
"totalPassCount": 2,

apps/codecov-api/graphql_api/tests/test_flake_aggregates_timescale.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from shared.django_apps.codecov_auth.tests.factories import OwnerFactory
77
from shared.django_apps.core.tests.factories import RepositoryFactory
88
from shared.django_apps.ta_timeseries.models import Testrun, calc_test_id
9-
from utils.timescale_test_results import get_flake_aggregates_from_timescale
9+
from utils.timescale.flake_aggregates import get_flake_aggregates_from_timescale
1010

1111
from .helper import GraphQLTestHelper
1212

@@ -81,11 +81,19 @@ def populate_timescale_flake_aggregates(repository):
8181

8282
with connections["ta_timeseries"].cursor() as cursor:
8383
cursor.execute(
84-
"CALL refresh_continuous_aggregate('ta_timeseries_testrun_branch_summary_1day', %s, %s)",
84+
"CALL refresh_continuous_aggregate('ta_timeseries_branch_test_aggregate_hourly', %s, %s)",
8585
[min_timestamp, max_timestamp],
8686
)
8787
cursor.execute(
88-
"CALL refresh_continuous_aggregate('ta_timeseries_testrun_summary_1day', %s, %s)",
88+
"CALL refresh_continuous_aggregate('ta_timeseries_branch_test_aggregate_daily', %s, %s)",
89+
[min_timestamp, max_timestamp],
90+
)
91+
cursor.execute(
92+
"CALL refresh_continuous_aggregate('ta_timeseries_test_aggregate_hourly', %s, %s)",
93+
[min_timestamp, max_timestamp],
94+
)
95+
cursor.execute(
96+
"CALL refresh_continuous_aggregate('ta_timeseries_test_aggregate_daily', %s, %s)",
8997
[min_timestamp, max_timestamp],
9098
)
9199
cursor.execute(

0 commit comments

Comments
 (0)