test: comprehensive test gap closure across 24 packages

Close coverage gaps identified by dual-audit (qualitative + quantitative).
New test files for config (0%→98%), router (0%→100%), handler validation,
health, audit, response helpers, webhook notifier (0%→88%), email notifier,
middleware (recovery, rate limiter), domain profile, service nil-safety,
config helpers, issuer bootstrap, and server bootstrap wiring. Expanded
existing tests for ACME (34%→42%), step-ca (42%→52%), F5, SSH, agent
(43%→63%), scheduler (88%→99%), renewal service, and issuerfactory.

All tests pass: go test -short, go vet, go test -race clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shankar0123
2026-04-09 23:09:40 -04:00
parent 5567d4b411
commit 7382e5f03b
24 changed files with 9225 additions and 4 deletions
+15
View File
@@ -24,6 +24,8 @@ type mockCertRepo struct {
ListVersionsResult []*domain.CertificateVersion
CreateVersionErr error
ArchiveErr error
Updated []*domain.ManagedCertificate
MockGetExpiring []*domain.ManagedCertificate
}
func (m *mockCertRepo) List(ctx context.Context, filter *repository.CertificateFilter) ([]*domain.ManagedCertificate, int, error) {
@@ -61,6 +63,7 @@ func (m *mockCertRepo) Update(ctx context.Context, cert *domain.ManagedCertifica
return m.UpdateErr
}
m.Certs[cert.ID] = cert
m.Updated = append(m.Updated, cert)
return nil
}
@@ -95,6 +98,10 @@ func (m *mockCertRepo) CreateVersion(ctx context.Context, version *domain.Certif
}
func (m *mockCertRepo) GetExpiringCertificates(ctx context.Context, before time.Time) ([]*domain.ManagedCertificate, error) {
// Return MockGetExpiring if set, for test control
if m.MockGetExpiring != nil {
return m.MockGetExpiring, nil
}
var expiring []*domain.ManagedCertificate
for _, c := range m.Certs {
if c.ExpiresAt.Before(before) {
@@ -128,6 +135,7 @@ type mockJobRepo struct {
ListErr error
ListByStatusErr error
DeleteErr error
Updated []*domain.Job
}
func (m *mockJobRepo) List(ctx context.Context) ([]*domain.Job, error) {
@@ -173,6 +181,7 @@ func (m *mockJobRepo) Update(ctx context.Context, job *domain.Job) error {
return m.UpdateErr
}
m.Jobs[job.ID] = job
m.Updated = append(m.Updated, job)
return nil
}
@@ -690,6 +699,12 @@ func (m *mockTargetRepo) AddTarget(target *domain.DeploymentTarget) {
m.Targets[target.ID] = target
}
func newMockTargetRepository() *mockTargetRepo {
return &mockTargetRepo{
Targets: make(map[string]*domain.DeploymentTarget),
}
}
// mockIssuerConnector is a test implementation of IssuerConnector
type mockIssuerConnector struct {
Result *IssuanceResult