Skip to content

Commit 3133041

Browse files
committed
Fix Install feature gates not needing 5 new tests
Install feature gates require entirely new jobs to be created that execise the new feature. New tests may be added and existing tests are usually updated to account for the new feature. Adjust the feature gate promotion verification code to account for that.
1 parent 13d08e2 commit 3133041

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

tools/codegen/cmd/featuregate-test-analyzer.go

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,9 @@ func (o *FeatureGateTestAnalyzerOptions) Run(ctx context.Context) error {
284284
md.Text("")
285285
}
286286

287-
// Only add blocking errors to the error list (warnings don't fail the job)
288-
errs = append(errs, groupErrorsByCategory(blockingResults)...)
287+
if len(blockingErrors) > 0 {
288+
errs = append(errs, blockingErrors...)
289+
}
289290
featureGateHTMLData = append(featureGateHTMLData, buildHTMLFeatureGateData(enabledFeatureGate, testingResults, blockingErrors, release))
290291

291292
}
@@ -303,7 +304,10 @@ func (o *FeatureGateTestAnalyzerOptions) Run(ctx context.Context) error {
303304
}
304305
}
305306

306-
return errors.Join(errs...)
307+
if len(errs) > 0 {
308+
return fmt.Errorf("feature gate promotion validation errors:\n%w", errors.Join(errs...))
309+
}
310+
return nil
307311
}
308312

309313
func topologyDisplayName(topology string) string {
@@ -437,12 +441,22 @@ func checkIfTestingIsSufficient(featureGate string, testingResults map[JobVarian
437441
}
438442

439443
if len(testedVariant.TestResults) < requiredNumberOfTests {
440-
results = append(results, ValidationResult{
441-
Error: fmt.Errorf("error: only %d tests found, need at least %d for %q on %v",
442-
len(testedVariant.TestResults), requiredNumberOfTests, featureGate, jobVariant),
443-
IsWarning: isOptional,
444-
Category: CategoryInsufficientTests,
445-
})
444+
if strings.Contains(featureGate, "Install") {
445+
results = append(results, ValidationResult{
446+
Error: fmt.Errorf("info: %d tests found for %q on %v",
447+
len(testedVariant.TestResults), featureGate, jobVariant),
448+
IsWarning: true,
449+
IsInfo: true,
450+
Category: CategoryInsufficientTests,
451+
})
452+
} else {
453+
results = append(results, ValidationResult{
454+
Error: fmt.Errorf("error: only %d tests found, need at least %d for %q on %v",
455+
len(testedVariant.TestResults), requiredNumberOfTests, featureGate, jobVariant),
456+
IsWarning: isOptional,
457+
Category: CategoryInsufficientTests,
458+
})
459+
}
446460
}
447461

448462
for _, testResults := range testedVariant.TestResults {

tools/codegen/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var rootCmd = &cobra.Command{
6161
func main() {
6262
err := rootCmd.Execute()
6363
if err != nil {
64-
klog.Fatalf("Error running codegen: %v", err)
64+
klog.Fatalf("%v", err)
6565
}
6666
}
6767

0 commit comments

Comments
 (0)