Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add namespaced custom installation test #622

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ test-e2e:
# Switch images from `registry.redhat.io` images to the dev images
.PHONY: dev-images
dev-images:
sed -E -f ci/dev-images.sed -i internal/controller/constants/images.go
@if [ "$(shell uname)" = "Darwin" ]; then \
sed -E -i '' -f ci/dev-images.sed internal/controller/constants/images.go; \
else \
sed -E -i -f ci/dev-images.sed internal/controller/constants/images.go; \
fi

GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.54.2
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
Loading