Skip to content

Conversation

dimitarvdimitrov
Copy link
Contributor

Summary

Extends the basic flaky test detection in #1013 with Git history analysis to identify recent authors of flaky tests. This enables better ownership tracking and more targeted notifications when tests become flaky.

What's Added

  • Git Integration: New GitClient interface and implementation for repository operations
  • Author Detection: Uses git log -L to find recent commits that modified specific test functions
  • Test File Discovery: Locates test files in the repository using grep patterns
  • Enriched Reports: Flaky test reports now include commit history and author information

Key Components

  • git.go: Git operations implementation with proper error handling
  • Enhanced analyzer.go: Now calls Git functions to gather author information
  • Updated action configuration: Adds repository-directory input parameter
  • Comprehensive test coverage for Git functionality

@dimitarvdimitrov dimitarvdimitrov requested a review from a team as a code owner June 17, 2025 13:15
Copy link
Contributor

@dsotirakis dsotirakis left a comment

Choose a reason for hiding this comment

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

changes look good - the linter fails because the github app doesn't have the necessary permissions it looks like?
(the other linter has actual lint issues that need to be fixed)

Add Git client implementation to track test authors:
- Find test files using grep search through repository
- Extract commit history using git log -L for specific test functions
- Filter commits to last 6 months to focus on recent contributors
- Add FilePath and RecentCommits to FlakyTest struct
- Update action to include repository-directory input
- Enhance test reporting with author information

Builds on PR1's Loki analysis with Git history tracking.
GitHub username resolution will be added in PR3.

# Conflicts:
#	actions/go-flaky-tests/cmd/go-flaky-tests/analyzer.go
@dimitarvdimitrov dimitarvdimitrov force-pushed the dimitar/analyze-test-failures/git-authors branch from 755b363 to c096b12 Compare August 15, 2025 09:47
@dimitarvdimitrov
Copy link
Contributor Author

i'm not sure what happened there, i rebased on main and it's working. can you take another look @dsotirakis ?

@dimitarvdimitrov
Copy link
Contributor Author

a short update - this has been working pretty well for us. The only change I've had to make in addition is to add the option to ignore some tests (tests which often fail on PRs, but catch actual bugs). I'll upstream that in a 4th PR (this is the 2nd PR, github issues integration is the 3rd, 4th is tiny)

Copy link
Contributor

@dsotirakis dsotirakis left a comment

Choose a reason for hiding this comment

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

looks great 🚀

@dimitarvdimitrov
Copy link
Contributor Author

do we need to do anything else to merge this? (I can't click merge)

@dsotirakis
Copy link
Contributor

do we need to do anything else to merge this? (I can't click merge)

oh sorry! I'll merge it for you :)

@dsotirakis dsotirakis added this pull request to the merge queue Aug 22, 2025
Merged via the queue into grafana:main with commit d005a71 Aug 22, 2025
18 checks passed
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.

2 participants