Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit ca8c9ff

Browse files
committed
feat: add totalFlakyFailCount to testResult
1 parent 827093a commit ca8c9ff

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

graphql_api/tests/test_test_result.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ def setUp(self):
3131
date=date.today() - timedelta(days=2),
3232
avg_duration_seconds=0.6,
3333
latest_run=datetime.now() - timedelta(days=2),
34+
flaky_fail_count=0,
3435
)
3536
_ = DailyTestRollupFactory(
3637
test=self.test,
3738
commits_where_fail=["123", "456"],
3839
date=datetime.now() - timedelta(days=1),
3940
avg_duration_seconds=2,
4041
latest_run=datetime.now() - timedelta(days=1),
42+
flaky_fail_count=1,
4143
)
4244
_ = DailyTestRollupFactory(
4345
test=self.test,
@@ -46,6 +48,7 @@ def setUp(self):
4648
last_duration_seconds=5.0,
4749
avg_duration_seconds=3,
4850
latest_run=datetime.now(),
51+
flaky_fail_count=1,
4952
)
5053

5154
def test_fetch_test_result_name(self) -> None:
@@ -354,3 +357,34 @@ def test_fetch_test_result_total_pass_count(self) -> None:
354357
]["totalPassCount"]
355358
== 3
356359
)
360+
361+
def test_fetch_test_result_total_flaky_fail_count(self) -> None:
362+
query = """
363+
query {
364+
owner(username: "%s") {
365+
repository(name: "%s") {
366+
... on Repository {
367+
testAnalytics {
368+
testResults {
369+
edges {
370+
node {
371+
totalFlakyFailCount
372+
}
373+
}
374+
}
375+
}
376+
}
377+
}
378+
}
379+
}
380+
""" % (self.owner.username, self.repository.name)
381+
382+
result = self.gql_request(query, owner=self.owner)
383+
384+
assert "errors" not in result
385+
assert (
386+
result["owner"]["repository"]["testAnalytics"]["testResults"]["edges"][0][
387+
"node"
388+
]["totalFlakyFailCount"]
389+
== 2
390+
)

graphql_api/types/test_results/test_results.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ type TestResult {
99
totalFailCount: Int!
1010
totalSkipCount: Int!
1111
totalPassCount: Int!
12+
totalFlakyFailCount: Int!
1213
}

graphql_api/types/test_results/test_results.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class TestDict(TypedDict):
1616
total_fail_count: int
1717
total_skip_count: int
1818
total_pass_count: int
19+
total_flaky_fail_count: int
1920
computed_name: str | None
2021

2122

@@ -70,3 +71,8 @@ def resolve_total_skip_count(test: TestDict, _: GraphQLResolveInfo) -> int:
7071
@test_result_bindable.field("totalPassCount")
7172
def resolve_total_pass_count(test: TestDict, _: GraphQLResolveInfo) -> int:
7273
return test["total_pass_count"]
74+
75+
76+
@test_result_bindable.field("totalFlakyFailCount")
77+
def resolve_total_flaky_fail_count(test: TestDict, _: GraphQLResolveInfo) -> int:
78+
return test["total_flaky_fail_count"]

0 commit comments

Comments
 (0)