all: add tests; imp errors

This commit is contained in:
Ainar Garipov
2022-09-12 19:28:26 +03:00
parent dffffec9d4
commit c20ca9b85e
13 changed files with 205 additions and 63 deletions

View File

@@ -24,10 +24,21 @@ import (
httptreemux "github.com/dimfeld/httptreemux/v5"
)
// ServiceWithConfig is an extension of the [agh.Service] interface for services
// that can return their configuration.
//
// TODO(a.garipov): Consider removing this generic interface if we figure out
// how to make it testable in a better way.
type ServiceWithConfig[ConfigType any] interface {
agh.Service
Config() (c ConfigType)
}
// ConfigManager is the configuration manager interface.
type ConfigManager interface {
DNS() (svc *dnssvc.Service)
Web() (svc *Service)
DNS() (svc ServiceWithConfig[*dnssvc.Config])
Web() (svc ServiceWithConfig[*Config])
UpdateDNS(ctx context.Context, c *dnssvc.Config) (err error)
UpdateWeb(ctx context.Context, c *Config) (err error)