mirror of
https://github.com/caddyserver/caddy.git
synced 2026-03-21 09:10:25 -04:00
Some checks failed
Tests / test (./cmd/caddy/caddy, ~1.26.0, macos-14, 0, 1.26, mac) (push) Waiting to run
Tests / test (./cmd/caddy/caddy.exe, ~1.26.0, windows-latest, True, 1.26, windows) (push) Waiting to run
Lint / lint (macos-14, mac) (push) Waiting to run
Lint / lint (windows-latest, windows) (push) Waiting to run
Tests / test (./cmd/caddy/caddy, ~1.26.0, ubuntu-latest, 0, 1.26, linux) (push) Failing after 1m37s
Tests / test (s390x on IBM Z) (push) Has been skipped
Tests / goreleaser-check (push) Has been skipped
Cross-Build / build (~1.26.0, 1.26, aix) (push) Successful in 1m29s
Cross-Build / build (~1.26.0, 1.26, darwin) (push) Successful in 1m28s
Cross-Build / build (~1.26.0, 1.26, dragonfly) (push) Successful in 1m23s
Cross-Build / build (~1.26.0, 1.26, freebsd) (push) Successful in 1m26s
Cross-Build / build (~1.26.0, 1.26, illumos) (push) Successful in 1m24s
Cross-Build / build (~1.26.0, 1.26, linux) (push) Successful in 1m25s
Cross-Build / build (~1.26.0, 1.26, netbsd) (push) Successful in 1m25s
Cross-Build / build (~1.26.0, 1.26, openbsd) (push) Successful in 1m23s
Cross-Build / build (~1.26.0, 1.26, solaris) (push) Successful in 1m34s
Cross-Build / build (~1.26.0, 1.26, windows) (push) Successful in 1m28s
Lint / lint (ubuntu-latest, linux) (push) Successful in 2m22s
Lint / govulncheck (push) Successful in 1m43s
Lint / dependency-review (push) Failing after 59s
OpenSSF Scorecard supply-chain security / Scorecard analysis (push) Failing after 36s
38 lines
997 B
Go
38 lines
997 B
Go
package caddytls
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/caddyserver/certmagic"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func TestAutomationPolicyMakeCertMagicConfigImplicitTailscaleManagersOnly(t *testing.T) {
|
|
ap := AutomationPolicy{
|
|
Managers: []certmagic.Manager{Tailscale{}},
|
|
subjects: []string{"test-node.example.ts.net"},
|
|
}
|
|
|
|
cfg, err := ap.makeCertMagicConfig(&TLS{
|
|
logger: zap.NewNop(),
|
|
}, nil, &certmagic.FileStorage{Path: t.TempDir()})
|
|
if err != nil {
|
|
t.Fatalf("making certmagic config: %v", err)
|
|
}
|
|
if cfg.OnDemand == nil {
|
|
t.Fatal("expected on-demand config to be set")
|
|
}
|
|
if len(cfg.Issuers) != 0 {
|
|
t.Fatalf("expected no issuers for tailscale-managed ts.net policy, got %d", len(cfg.Issuers))
|
|
}
|
|
}
|
|
|
|
func TestAutomationPolicyImplicitTailscaleManagersOnlyCatchAll(t *testing.T) {
|
|
ap := AutomationPolicy{
|
|
Managers: []certmagic.Manager{Tailscale{}},
|
|
}
|
|
if ap.implicitTailscaleManagersOnly() {
|
|
t.Fatal("expected catch-all manager policy to remain outside tailscale-only special case")
|
|
}
|
|
}
|