From fa4cc3a2ae6fa63bfbd8b005e4048dacc222dcc1 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Wed, 21 Jan 2026 01:12:11 +0700 Subject: all: implement default down and up templates under section "[default"] To minimize defining the same templates in notification, user can set default down and up templates under the default section. --- server_config_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'server_config_test.go') diff --git a/server_config_test.go b/server_config_test.go index bd17b5e..56542d6 100644 --- a/server_config_test.go +++ b/server_config_test.go @@ -37,6 +37,8 @@ func TestServerConfig_init(t *testing.T) { configServiceDir: `testdata/server_config/ok/etc/lilin/service.d`, logServiceDir: `testdata/server_config/ok/var/log/lilin/service.d`, Address: `127.0.0.1:12121`, + DownTemplate: defaultDownTemplate, + UpTemplate: defaultUpTemplate, Notifs: []*NotifConfig{{ Kind: `mattermost`, RemoteURL: `http://127.0.0.1:12000`, @@ -76,6 +78,15 @@ func TestServerConfig_init(t *testing.T) { t.Fatal(err) } + if cfg.upTmpl == nil { + t.Fatal(`ServerConfig: got nil on upTmpl, want not-nil`) + } + if cfg.downTmpl == nil { + t.Fatal(`ServerConfig: got nil on downTmpl, want not-nil`) + } + cfg.upTmpl = nil + cfg.downTmpl = nil + for x, notifCfg := range cfg.Notifs { if notifCfg.upTmpl == nil { t.Fatalf(`ServerConfig.Notifs #%d: upTmpl is nil`, x) -- cgit v1.3