frostfs-node/cmd/neofs-node/config/apiclient/config_test.go
Alex Vanin 27b4781e95 [#493] cmd/node: Add apiclient section to config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-06-02 16:07:42 +03:00

31 lines
838 B
Go

package apiclientconfig_test
import (
"testing"
"time"
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
apiclientconfig "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/apiclient"
configtest "github.com/nspcc-dev/neofs-node/cmd/neofs-node/config/test"
"github.com/stretchr/testify/require"
)
func TestApiclientSection(t *testing.T) {
t.Run("defaults", func(t *testing.T) {
empty := configtest.EmptyConfig()
require.Equal(t, apiclientconfig.DialTimeoutDefault, apiclientconfig.DialTimeout(empty))
})
const path = "../../../../config/example/node"
var fileConfigTest = func(c *config.Config) {
require.Equal(t, 15*time.Second, apiclientconfig.DialTimeout(c))
}
configtest.ForEachFileType(path, fileConfigTest)
t.Run("ENV", func(t *testing.T) {
configtest.ForEnvFileType(path, fileConfigTest)
})
}