Skip to content

Commit

Permalink
test: add namespaced custom installation test
Browse files Browse the repository at this point in the history
  • Loading branch information
osmman committed Sep 16, 2024
1 parent 0159bc9 commit 1928dae
Show file tree
Hide file tree
Showing 3 changed files with 388 additions and 5 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ run:
build-tags:
- integration
- upgrade
- custom_install

issues:
# don't skip warning about doc comments
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/custom_install/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var _ = Describe("Securesign install in proxy-env", Ordered, func() {
installOperatorWithProxyConf(ctx, cli, hostname, namespace.Name)

DeferCleanup(func() {
cli.Delete(ctx, namespace)
_ = cli.Delete(ctx, namespace)
})
})

Expand Down Expand Up @@ -173,7 +173,7 @@ var _ = Describe("Securesign install in proxy-env", Ordered, func() {
if err != nil {
Fail(err.Error())
}
defer podLogs.Close()
defer func() { _ = podLogs.Close() }()

buf := new(bytes.Buffer)
_, err = io.Copy(buf, podLogs)
Expand Down Expand Up @@ -202,7 +202,7 @@ func deploymentCertificate(hostname string, ns string) *v1.Secret {

// generate the certificate private key
certPrivateKey, err := rsa.GenerateKey(rand.Reader, 2048)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())

privateKeyBytes := x509.MarshalPKCS1PrivateKey(certPrivateKey)
// encode for storing into a Secret
Expand All @@ -213,7 +213,7 @@ func deploymentCertificate(hostname string, ns string) *v1.Secret {
},
)
certBytes, err := x509.CreateCertificate(rand.Reader, cert, cert, &certPrivateKey.PublicKey, certPrivateKey)
Expect(err).To(BeNil())
Expect(err).ToNot(HaveOccurred())

// encode for storing into a Secret
certPem := pem.EncodeToMemory(&pem.Block{
Expand Down Expand Up @@ -437,7 +437,7 @@ func rbac(ns string) []runtimeCli.Object {
if u.GetObjectKind().GroupVersionKind().Kind == "ClusterRoleBinding" {
binding := &v12.ClusterRoleBinding{}
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(u.Object, binding); err == nil {
for i, _ := range binding.Subjects {
for i := range binding.Subjects {
binding.Subjects[i].Namespace = ns
}
objects = append(objects, binding)
Expand Down
Loading

0 comments on commit 1928dae

Please sign in to comment.