Skip to content

Commit 7e0d642

Browse files
authored
Merge pull request kubernetes#2207 from wojtek-t/prod_readiness_hints
PRR approval descriptive errors
2 parents ec237ee + 789ed76 commit 7e0d642

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

cmd/kepval/main_test.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,23 @@ func TestValidation(t *testing.T) {
9595
return
9696
}
9797

98-
prrFilename := filepath.Join(prrsDir, kep.OwningSIG, kep.Number)
98+
var stageMilestone string
99+
switch kep.Stage {
100+
case "alpha":
101+
stageMilestone = kep.Milestone.Alpha
102+
case "beta":
103+
stageMilestone = kep.Milestone.Beta
104+
case "stable":
105+
stageMilestone = kep.Milestone.Stable
106+
}
107+
108+
prrFilename := kep.Number + ".yaml"
109+
prrFilename = filepath.Join(prrsDir, kep.OwningSIG, prrFilename)
99110
prrFile, err := os.Open(prrFilename)
100111
if os.IsNotExist(err) {
101-
t.Errorf("missing PRR Approval file under: %s", prrFilename)
112+
t.Errorf("PRR approval is required to target milestone %v (stage %v)", stageMilestone, kep.Stage)
113+
t.Errorf("For more details about PRR approval see: https://github.com/kubernetes/community/blob/master/sig-architecture/production-readiness.md")
114+
t.Errorf("To get PRR approval modify appropriately file %s and have this approved by PRR team", prrFilename)
102115
return
103116
}
104117
if err != nil {
@@ -110,23 +123,21 @@ func TestValidation(t *testing.T) {
110123
return
111124
}
112125

113-
var stageMilestone string
114126
var stagePRRApprover string
115127
switch kep.Stage {
116128
case "alpha":
117-
stageMilestone = kep.Milestone.Alpha
118129
stagePRRApprover = prr.Alpha.Approver
119130
case "beta":
120-
stageMilestone = kep.Milestone.Beta
121131
stagePRRApprover = prr.Beta.Approver
122132
case "stable":
123-
stageMilestone = kep.Milestone.Stable
124133
stagePRRApprover = prr.Stable.Approver
125134
}
126135
if len(stageMilestone) > 0 && stageMilestone >= "v1.21" {
127136
// PRR approval is needed.
128137
if len(stagePRRApprover) == 0 {
129-
t.Errorf("PRR not approved for: %s", kep.Stage)
138+
t.Errorf("PRR approval is required to target milestone %v (stage %v)", stageMilestone, kep.Stage)
139+
t.Errorf("For more details about PRR approval see: https://github.com/kubernetes/community/blob/master/sig-architecture/production-readiness.md")
140+
t.Errorf("To get PRR approval modify appropriately file %s and have this approved by PRR team", prrFilename)
130141
}
131142
}
132143
})

0 commit comments

Comments
 (0)