Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Create hook for test results #3044

Merged
merged 3 commits into from
Jul 22, 2024
Merged

feat: Create hook for test results #3044

merged 3 commits into from
Jul 22, 2024

Conversation

RulaKhaled
Copy link
Contributor

Description

Create hook for test results new table

closes: codecov/engineering-team#2071

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@codecov-staging
Copy link

codecov-staging bot commented Jul 22, 2024

Bundle Report

Changes will increase total bundle size by 533 bytes ⬆️

Bundle name Size Change
gazebo-staging-array-push 5.86MB 533 bytes ⬆️

Copy link

codecov bot commented Jul 22, 2024

Bundle Report

Changes will increase total bundle size by 533 bytes ⬆️

Bundle name Size Change
gazebo-production-array-push 5.86MB 533 bytes ⬆️

@codecov-qa
Copy link

codecov-qa bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.37%. Comparing base (bb1d052) to head (536c0d3).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3044   +/-   ##
=======================================
  Coverage   98.36%   98.37%           
=======================================
  Files         914      915    +1     
  Lines       13604    13642   +38     
  Branches     3679     3703   +24     
=======================================
+ Hits        13382    13420   +38     
  Misses        218      218           
  Partials        4        4           
Files Coverage Δ
...ge/FailedTestsTab/hooks/useInfiniteTestResults.tsx 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.71% <ø> (ø)
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <ø> (+<0.01%) ⬆️
Shared 99.69% <ø> (ø)
UI 94.36% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb1d052...536c0d3. Read the comment docs.

@codecov-notifications
Copy link

codecov-notifications bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3044   +/-   ##
=======================================
  Coverage   98.36%   98.37%           
=======================================
  Files         914      915    +1     
  Lines       13604    13642   +38     
  Branches     3657     3698   +41     
=======================================
+ Hits        13382    13420   +38     
  Misses        218      218           
  Partials        4        4           
Files Coverage Δ
...ge/FailedTestsTab/hooks/useInfiniteTestResults.tsx 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.71% <ø> (ø)
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <ø> (+<0.01%) ⬆️
Shared 99.69% <ø> (ø)
UI 94.36% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb1d052...536c0d3. Read the comment docs.

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.37%. Comparing base (bb1d052) to head (536c0d3).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##               main      #3044        +/-   ##
================================================
+ Coverage   98.36000   98.37000   +0.01000     
================================================
  Files           914        915         +1     
  Lines         13604      13642        +38     
  Branches       3657       3674        +17     
================================================
+ Hits          13382      13420        +38     
  Misses          218        218                
  Partials          4          4                
Files Coverage Δ
...ge/FailedTestsTab/hooks/useInfiniteTestResults.tsx 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.71% <ø> (ø)
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <ø> (+<0.01%) ⬆️
Shared 99.69% <ø> (ø)
UI 94.36% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb1d052...536c0d3. Read the comment docs.

Copy link

codecov-public-qa bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.37%. Comparing base (bb1d052) to head (536c0d3).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3044   +/-   ##
=======================================
  Coverage   98.36%   98.37%           
=======================================
  Files         914      915    +1     
  Lines       13604    13642   +38     
  Branches     3679     3698   +19     
=======================================
+ Hits        13382    13420   +38     
  Misses        218      218           
  Partials        4        4           
Files Coverage Δ
...ge/FailedTestsTab/hooks/useInfiniteTestResults.tsx 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

Components Coverage Δ
Assets 53.84% <ø> (ø)
Layouts 97.71% <ø> (ø)
Pages 99.16% <100.00%> (+<0.01%) ⬆️
Services 99.47% <ø> (+<0.01%) ⬆️
Shared 99.69% <ø> (ø)
UI 94.36% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bb1d052...536c0d3. Read the comment docs.

@codecov-releaser
Copy link
Contributor

codecov-releaser commented Jul 22, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
7168be0 Mon, 22 Jul 2024 11:21:29 GMT Expired Expired
bcd540b Mon, 22 Jul 2024 12:06:53 GMT Expired Expired
536c0d3 Mon, 22 Jul 2024 15:24:25 GMT Cloud Enterprise

@RulaKhaled RulaKhaled marked this pull request as ready for review July 22, 2024 11:57
Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of comments to peak at

Comment on lines 50 to 88
const query = `
query GetTestResults(
$owner: String!
$repo: String!
$filters: TestResultsFilters
$first: Int
$after: String
$last: Int
$before: String
) {
owner(username: $owner) {
repository: repository(name: $repo) {
__typename
... on Repository {
testResults(filters: $filters, first: $first, after: $after, last: $last, before: $before) {
edges {
node {
updatedAt
avgDuration
name
failureRate
commitsFailed
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
... on NotFoundError {
message
}
... on OwnerNotActivatedError {
message
}
}
}
}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: Just tidying up the testResults args formatting

Suggested change
const query = `
query GetTestResults(
$owner: String!
$repo: String!
$filters: TestResultsFilters
$first: Int
$after: String
$last: Int
$before: String
) {
owner(username: $owner) {
repository: repository(name: $repo) {
__typename
... on Repository {
testResults(filters: $filters, first: $first, after: $after, last: $last, before: $before) {
edges {
node {
updatedAt
avgDuration
name
failureRate
commitsFailed
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
... on NotFoundError {
message
}
... on OwnerNotActivatedError {
message
}
}
}
}`
const query = `
query GetTestResults(
$owner: String!
$repo: String!
$filters: TestResultsFilters
$first: Int
$after: String
$last: Int
$before: String
) {
owner(username: $owner) {
repository: repository(name: $repo) {
__typename
... on Repository {
testResults(
filters: $filters
first: $first
after: $after
last: $last
before: $before
) {
edges {
node {
updatedAt
avgDuration
name
failureRate
commitsFailed
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
... on NotFoundError {
message
}
... on OwnerNotActivatedError {
message
}
}
}
}`

Comment on lines 185 to 187
data?.owner?.repository?.testResults?.edges?.map(
(edge) => edge.node
) ?? [],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: We have a typesafe util function to do this mapping for you, and will handle all of the potential other cases for you as well: mapEdges

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i actually tried to use it but for some reason it fails when using it. I think something's off with the expected returned type in mapEdges i've seen this happen with useInfiniteQuery a couple of times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any tip is welcomed!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do the following and it'll make everything happy:

testResults: mapEdges(data?.owner?.repository?.testResults).filter(
  (item): item is TestResult => item !== null
),

Copy link
Contributor

@nicholas-codecov nicholas-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RulaKhaled RulaKhaled added this pull request to the merge queue Jul 22, 2024
Merged via the queue into main with commit 73a9d72 Jul 22, 2024
61 checks passed
@RulaKhaled RulaKhaled deleted the test-results-hook branch July 22, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Gazebo] Create new hook to fetch test results
3 participants