Skip to content

Commit

Permalink
Fix lint and an bug in existing code
Browse files Browse the repository at this point in the history
  • Loading branch information
xueqzhan committed Dec 20, 2024
1 parent 875696b commit b218d0b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/api/componentreadiness/component_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ func (c *componentReportGenerator) matchBaseRegression(testID crtype.ReportTestI
baseRegression = regressionallowances.IntentionalRegressionFor(baseRelease, testID.ColumnIdentification, testID.TestID)

// This could go away if we remove the option for ignoring fallback
if baseRegression != nil && baseRegression.PreviousPassPercentage(c.FlakeAsFailure) > c.getTestStatusSuccessRate(baseStats) {
if baseRegression != nil && baseRegression.PreviousPassPercentage(c.FlakeAsFailure) > c.getTestStatusPassRate(baseStats) {
// override with the basis regression previous values
// testStats will reflect the expected threshold, not the computed values from the release with the allowed regression
baseRegressionPreviousRelease, err := previousRelease(c.BaseRelease.Release)
Expand Down Expand Up @@ -1463,7 +1463,7 @@ func getFailureCount(status crtype.JobRunTestStatusRow) int {
return failure
}

func (c *componentReportGenerator) getTestStatusSuccessRate(testStatus crtype.TestStatus) float64 {
func (c *componentReportGenerator) getTestStatusPassRate(testStatus crtype.TestStatus) float64 {
return c.getPassRate(testStatus.SuccessCount, testStatus.TotalCount-testStatus.SuccessCount-testStatus.FlakeCount, testStatus.FlakeCount)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/api/componentreadiness/component_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ func TestGenerateComponentTestDetailsReport(t *testing.T) {
JobName: prowJob1,
SampleStats: sampleTestStatsLow,
BaseStats: baseTestStatsHigh,
Significant: false,
Significant: true,
},
},
},
Expand Down
14 changes: 10 additions & 4 deletions pkg/api/componentreadiness/test_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,18 @@ func (c *componentReportGenerator) internalGenerateTestDetailsReport(ctx context
jobStats.SampleStats.SuccessRate = c.getPassRate(perJobSampleSuccess, perJobSampleFailure, perJobSampleFlake)
perceivedSampleFailure := perJobSampleFailure
perceivedBaseFailure := perJobBaseFailure
perceivedSampleSuccess := perJobSampleSuccess + perJobSampleFlake
perceivedBaseSuccess := perJobBaseSuccess + perJobBaseFlake
if c.FlakeAsFailure {
perceivedSampleFailure = perJobSampleFailure + perJobSampleFlake
perJobBaseFailure = perJobBaseFailure + perJobBaseFlake
perceivedBaseFailure = perJobBaseFailure + perJobBaseFlake
perceivedSampleSuccess = perJobSampleSuccess
perceivedBaseSuccess = perJobBaseSuccess
}
_, _, r, _ := fet.FisherExactTest(perceivedSampleFailure,
perJobSampleSuccess,
perceivedSampleSuccess,
perceivedBaseFailure,
perJobSampleSuccess)
perceivedBaseSuccess)
jobStats.Significant = r < 1-float64(c.Confidence)/100

result.JobStats = append(result.JobStats, jobStats)
Expand Down Expand Up @@ -357,11 +361,13 @@ func (c *componentReportGenerator) internalGenerateTestDetailsReport(ctx context
jobStats.SampleStats.SuccessRate = c.getPassRate(perJobSampleSuccess, perJobSampleFailure, perJobSampleFlake)
result.JobStats = append(result.JobStats, jobStats)
perceivedSampleFailure := perJobSampleFailure
perceivedSampleSuccess := perJobSampleSuccess + perJobSampleFlake
if c.FlakeAsFailure {
perceivedSampleFailure = perJobSampleFailure + perJobSampleFlake
perceivedSampleSuccess = perJobSampleSuccess
}
_, _, r, _ := fet.FisherExactTest(perceivedSampleFailure,
perJobSampleSuccess,
perceivedSampleSuccess,
0,
0)
jobStats.Significant = r < 1-float64(c.Confidence)/100
Expand Down

0 comments on commit b218d0b

Please sign in to comment.