Tests cover: first-run baseline, NS change detection, record change detection, port state changes, TLS expiry warnings, graceful shutdown, and NS failure/recovery scenarios.
23 lines
520 B
Go
23 lines
520 B
Go
package state
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"sneak.berlin/go/dnswatcher/internal/config"
|
|
)
|
|
|
|
// NewForTest creates a State for unit testing with no persistence.
|
|
func NewForTest() *State {
|
|
return &State{
|
|
log: slog.Default(),
|
|
snapshot: &Snapshot{
|
|
Version: stateVersion,
|
|
Domains: make(map[string]*DomainState),
|
|
Hostnames: make(map[string]*HostnameState),
|
|
Ports: make(map[string]*PortState),
|
|
Certificates: make(map[string]*CertificateState),
|
|
},
|
|
config: &config.Config{DataDir: ""},
|
|
}
|
|
}
|