Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions graphql_api/tests/test_test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ def setUp(self):
date=date.today() - timedelta(days=2),
avg_duration_seconds=0.6,
latest_run=datetime.now() - timedelta(days=2),
flaky_fail_count=0,
)
_ = DailyTestRollupFactory(
test=self.test,
commits_where_fail=["123", "456"],
date=datetime.now() - timedelta(days=1),
avg_duration_seconds=2,
latest_run=datetime.now() - timedelta(days=1),
flaky_fail_count=1,
)
_ = DailyTestRollupFactory(
test=self.test,
Expand All @@ -46,6 +48,7 @@ def setUp(self):
last_duration_seconds=5.0,
avg_duration_seconds=3,
latest_run=datetime.now(),
flaky_fail_count=1,
)

def test_fetch_test_result_name(self) -> None:
Expand Down Expand Up @@ -354,3 +357,34 @@ def test_fetch_test_result_total_pass_count(self) -> None:
]["totalPassCount"]
== 3
)

def test_fetch_test_result_total_flaky_fail_count(self) -> None:
query = """
query {
owner(username: "%s") {
repository(name: "%s") {
... on Repository {
testAnalytics {
testResults {
edges {
node {
totalFlakyFailCount
}
}
}
}
}
}
}
}
""" % (self.owner.username, self.repository.name)

result = self.gql_request(query, owner=self.owner)

assert "errors" not in result
assert (
result["owner"]["repository"]["testAnalytics"]["testResults"]["edges"][0][
"node"
]["totalFlakyFailCount"]
== 2
)
1 change: 1 addition & 0 deletions graphql_api/types/test_results/test_results.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ type TestResult {
totalFailCount: Int!
totalSkipCount: Int!
totalPassCount: Int!
totalFlakyFailCount: Int!
}
6 changes: 6 additions & 0 deletions graphql_api/types/test_results/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class TestDict(TypedDict):
total_fail_count: int
total_skip_count: int
total_pass_count: int
total_flaky_fail_count: int
computed_name: str | None


Expand Down Expand Up @@ -70,3 +71,8 @@ def resolve_total_skip_count(test: TestDict, _: GraphQLResolveInfo) -> int:
@test_result_bindable.field("totalPassCount")
def resolve_total_pass_count(test: TestDict, _: GraphQLResolveInfo) -> int:
return test["total_pass_count"]


@test_result_bindable.field("totalFlakyFailCount")
def resolve_total_flaky_fail_count(test: TestDict, _: GraphQLResolveInfo) -> int:
return test["total_flaky_fail_count"]
Loading