Skip to content

Commit 69e9f7a

Browse files
Merge pull request #29327 from vrutkovs/tls-registry-test-using-the-cert
OCPBUGS-57049: TLS registry: refactor testcase annotations
2 parents 9c672e0 + 1843b4c commit 69e9f7a

File tree

11 files changed

+22421
-3
lines changed

11 files changed

+22421
-3
lines changed

pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/autoregenerate_after_expiry/requirement.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package autoregenerate_after_expiry
22

33
import (
44
"github.com/openshift/library-go/pkg/markdown"
5+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/testcase"
56
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatainterfaces"
67
)
78

@@ -20,7 +21,7 @@ func NewAutoRegenerateAfterOfflineExpiryRequirement() tlsmetadatainterfaces.Requ
2021
md.Text("To assert that a particular cert/key pair or CA bundle can do this, add the annotation to the secret or configmap.")
2122
md.Text("```yaml")
2223
md.Text(" annotations:")
23-
md.Textf(" %v: https//github.com/link/to/pr/adding/annotation, \"quote escaped formatted name of e2e test that ensures the PKI artifact functions properly\"", annotationName)
24+
md.Textf(" %v: https//github.com/link/to/pr/adding/annotation", annotationName)
2425
md.Text("```")
2526
md.Text("")
2627
md.Text("This assertion means that you have")
@@ -29,7 +30,9 @@ func NewAutoRegenerateAfterOfflineExpiryRequirement() tlsmetadatainterfaces.Requ
2930
md.Text("Manually tested that this works or seen someone else manually test that this works. AND")
3031
md.NewOrderedListItem()
3132
md.Text("Written an automated e2e test to ensure this PKI artifact is function that is a blocking GA criteria, and/or")
33+
md.NewOrderedListItem()
3234
md.Text("QE has required test every release that ensures the functionality works every release.")
35+
md.Textf("This TLS artifact has associated test name annotation (%q).", testcase.AnnotationName)
3336
md.OrderedListEnd()
3437
md.Text("If you have not done this, you should not merge the annotation.")
3538

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package refresh_period
2+
3+
import (
4+
"github.com/openshift/library-go/pkg/markdown"
5+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/testcase"
6+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatainterfaces"
7+
)
8+
9+
const annotationName string = "certificates.openshift.io/refresh-period"
10+
11+
type RefreshPeriodRequirement struct{}
12+
13+
func NewRefreshPeriodRequirement() tlsmetadatainterfaces.Requirement {
14+
15+
md := markdown.NewMarkdown("")
16+
md.Text("Acknowledging that a cert/key pair or CA bundle can be refreshed means")
17+
md.Text("that certificate is being updated before its expiration date as required without human")
18+
md.Text("intervention.")
19+
md.Text("")
20+
md.Text("To assert that a particular cert/key pair or CA bundle can be refreshed, add the annotation to the secret or configmap.")
21+
md.Text("```yaml")
22+
md.Text(" annotations:")
23+
md.Textf(" %v: <refresh period, e.g. 15d or 2y>", annotationName)
24+
md.Text("```")
25+
md.Text("")
26+
md.Text("This assertion means that you have")
27+
md.OrderedListStart()
28+
md.NewOrderedListItem()
29+
md.Text("Manually tested that this works or seen someone else manually test that this works. AND")
30+
md.NewOrderedListItem()
31+
md.Text("Written an automated e2e test to ensure this PKI artifact is function that is a blocking GA criteria, and/or")
32+
md.Text("QE has required test every release that ensures the functionality works every release.")
33+
md.NewOrderedListItem()
34+
md.Textf("This TLS artifact has associated test name annotation (%q).", testcase.AnnotationName)
35+
md.OrderedListEnd()
36+
md.Text("If you have not done this, you should not merge the annotation.")
37+
38+
return tlsmetadatainterfaces.NewAnnotationRequirement(
39+
// requirement name
40+
"refresh-period",
41+
// cert or configmap annotation
42+
annotationName,
43+
"Refresh Period",
44+
string(md.ExactBytes()),
45+
)
46+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package testcase
2+
3+
import (
4+
"github.com/openshift/library-go/pkg/markdown"
5+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatainterfaces"
6+
)
7+
8+
const AnnotationName string = "certificates.openshift.io/test-name"
9+
10+
type TestNameRequirement struct{}
11+
12+
func NewTestNameRequirement() tlsmetadatainterfaces.Requirement {
13+
14+
md := markdown.NewMarkdown("")
15+
md.Text("Every TLS artifact should be associated with a test, which checks that cert key pair.")
16+
md.Text("or CA bundle is being properly issued, refreshed, regenerated while offline")
17+
md.Text("and correctly reloaded.")
18+
md.Text("")
19+
md.Text("To assert that a particular cert/key pair or CA bundle is being tested, add the annotation to the secret or configmap.")
20+
md.Text("```yaml")
21+
md.Text(" annotations:")
22+
md.Textf(" %v: name of e2e test that ensures the PKI artifact functions properly", AnnotationName)
23+
md.Text("```")
24+
md.Text("")
25+
md.Text("This assertion means that you have")
26+
md.OrderedListStart()
27+
md.NewOrderedListItem()
28+
md.Text("Manually tested that this works or seen someone else manually test that this works. AND")
29+
md.NewOrderedListItem()
30+
md.Text("Written an automated e2e test to ensure this PKI artifact is function that is a blocking GA criteria, and/or")
31+
md.Text("QE has required test every release that ensures the functionality works every release.")
32+
md.OrderedListEnd()
33+
md.Text("If you have not done this, you should not merge the annotation.")
34+
35+
return tlsmetadatainterfaces.NewAnnotationRequirement(
36+
// requirement name
37+
"testcase",
38+
// cert or configmap annotation
39+
AnnotationName,
40+
"Test Cases",
41+
string(md.ExactBytes()),
42+
)
43+
}

pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatadefaults/defaults.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ import (
44
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/autoregenerate_after_expiry"
55
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/descriptions"
66
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/ownership"
7+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/refresh_period"
8+
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadata/testcase"
79
"github.com/openshift/origin/pkg/cmd/update-tls-artifacts/generate-owners/tlsmetadatainterfaces"
810
)
911

1012
func GetDefaultTLSRequirements() []tlsmetadatainterfaces.Requirement {
1113
return []tlsmetadatainterfaces.Requirement{
1214
ownership.NewOwnerRequirement(),
15+
testcase.NewTestNameRequirement(),
1316
autoregenerate_after_expiry.NewAutoRegenerateAfterOfflineExpiryRequirement(),
17+
refresh_period.NewRefreshPeriodRequirement(),
1418
descriptions.NewDescriptionRequirement(),
1519
}
1620
}

tls/autoregenerate-after-expiry/autoregenerate-after-expiry.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ intervention.
6565
To assert that a particular cert/key pair or CA bundle can do this, add the annotation to the secret or configmap.
6666
```yaml
6767
annotations:
68-
certificates.openshift.io/auto-regenerate-after-offline-expiry: https//github.com/link/to/pr/adding/annotation, "quote escaped formatted name of e2e test that ensures the PKI artifact functions properly"
68+
certificates.openshift.io/auto-regenerate-after-offline-expiry: https//github.com/link/to/pr/adding/annotation
6969
```
7070
7171
This assertion means that you have
7272
1. Manually tested that this works or seen someone else manually test that this works. AND
7373
2. Written an automated e2e test to ensure this PKI artifact is function that is a blocking GA criteria, and/or
74-
QE has required test every release that ensures the functionality works every release.
74+
3. QE has required test every release that ensures the functionality works every release.
75+
This TLS artifact has associated test name annotation ("certificates.openshift.io/test-name").
7576
If you have not done this, you should not merge the annotation.
7677
7778
## Items Do NOT Meet the Requirement (240)

0 commit comments

Comments
 (0)