Files
capsule/pkg/runtime/cert/options_test.go
T
3d1158ed23 fix: correct tls reconciler and add tenantowners (#1946)
* fix(controller): decode old object for delete requests

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: modernize golang

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: modernize golang

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* chore: modernize golang

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>

* fix: tls controller

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* feat: add tenantowner tenant status reference

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: tlsreconciler only patches cabundles

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* chore: refactor logger usage

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix: tlsreconciler only patches cabundles

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

* fix: tlsreconciler only patches cabundles

Signed-off-by: Oliver Baehler <oliver@sudo-i.net>

---------

Signed-off-by: Oliver Bähler <oliverbaehler@hotmail.com>
Signed-off-by: Oliver Baehler <oliver@sudo-i.net>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-03 16:02:17 +02:00

52 lines
1.0 KiB
Go

// Copyright 2020-2026 Project Capsule Authors
// SPDX-License-Identifier: Apache-2.0
package cert
import (
"net"
"testing"
"time"
)
func TestNewCertOpts(t *testing.T) {
t.Parallel()
expirationDate := time.Now().Add(24 * time.Hour).UTC()
opts := NewCertOpts(expirationDate, CertificateSANs{
DNSNames: []string{
" Webhook.Capsule-System.Svc ",
"webhook.capsule-system.svc",
"api.example.com",
},
IPAddrs: []net.IP{
net.ParseIP("10.96.0.10"),
net.ParseIP("10.96.0.10"),
nil,
},
})
if !opts.GetExpirationDate().Equal(expirationDate) {
t.Fatalf("expected expiration date %s, got %s", expirationDate, opts.GetExpirationDate())
}
expectedSANs := CertificateSANs{
DNSNames: []string{
"api.example.com",
"webhook.capsule-system.svc",
},
IPAddrs: []net.IP{
net.ParseIP("10.96.0.10"),
},
}
assertCertificateSANsEqual(t, expectedSANs, opts.GetDNSNames())
}
func TestCertOptsImplementsCertificateOptions(t *testing.T) {
t.Parallel()
var _ CertificateOptions = CertOpts{}
}