cmd/cli: add config to control DNS watchdog

This commit is contained in:
Cuong Manh Le
2024-07-26 17:17:44 +07:00
committed by Cuong Manh Le
parent 18a19a3aa2
commit ec684348ed
6 changed files with 129 additions and 24 deletions

View File

@@ -5,6 +5,7 @@ import (
"os"
"strings"
"testing"
"time"
"github.com/go-playground/validator/v10"
"github.com/spf13/viper"
@@ -22,6 +23,8 @@ func TestLoadConfig(t *testing.T) {
assert.Equal(t, "info", cfg.Service.LogLevel)
assert.Equal(t, "/path/to/log.log", cfg.Service.LogPath)
assert.Equal(t, false, *cfg.Service.DnsWatchdogEnabled)
assert.Equal(t, time.Duration(20*time.Second), *cfg.Service.DnsWatchdogInvterval)
assert.Len(t, cfg.Network, 2)
assert.Contains(t, cfg.Network, "0")