Skip to content

Commit 842a4b6

Browse files
committed
add test tracking raw cert data
1 parent ffb7a7a commit 842a4b6

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

test/extended/operators/certs.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package operators
2+
3+
import (
4+
"context"
5+
"encoding/json"
6+
"fmt"
7+
"os"
8+
"path/filepath"
9+
10+
g "github.com/onsi/ginkgo/v2"
11+
o "github.com/onsi/gomega"
12+
"github.com/openshift/library-go/pkg/certs/cert-inspection/certgraphanalysis"
13+
"github.com/openshift/origin/pkg/monitortestlibrary/platformidentification"
14+
exutil "github.com/openshift/origin/test/extended/util"
15+
)
16+
17+
var _ = g.Describe("[sig-arch][Late]", func() {
18+
defer g.GinkgoRecover()
19+
20+
oc := exutil.NewCLIWithoutNamespace("certificate-checker")
21+
22+
g.It("collect certificate data", func() {
23+
24+
ctx := context.Background()
25+
kubeClient := oc.AdminKubeClient()
26+
if ok, _ := exutil.IsMicroShiftCluster(kubeClient); ok {
27+
g.Skip("microshift does not auto-collect TLS.")
28+
}
29+
jobType, err := platformidentification.GetJobType(context.TODO(), oc.AdminConfig())
30+
o.Expect(err).NotTo(o.HaveOccurred())
31+
tlsArtifactFilename := fmt.Sprintf("raw-tls-artifacts-%s-%s-%s-%s.json", jobType.Topology, jobType.Architecture, jobType.Platform, jobType.Network)
32+
33+
currentPKIContent, err := certgraphanalysis.GatherCertsFromPlatformNamespaces(ctx, kubeClient)
34+
o.Expect(err).NotTo(o.HaveOccurred())
35+
36+
jsonBytes, err := json.MarshalIndent(currentPKIContent, "", " ")
37+
o.Expect(err).NotTo(o.HaveOccurred())
38+
39+
pkiDir := filepath.Join(exutil.ArtifactDirPath(), "rawTLSInfo")
40+
err = os.MkdirAll(pkiDir, 0755)
41+
o.Expect(err).NotTo(o.HaveOccurred())
42+
err = os.WriteFile(filepath.Join(pkiDir, tlsArtifactFilename), jsonBytes, 0644)
43+
o.Expect(err).NotTo(o.HaveOccurred())
44+
})
45+
46+
})

test/extended/util/annotate/generated/zz_generated.annotations.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)