1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/logger/fluentd/fluentd_test.go

25 lines
728 B
Go
Raw Normal View History

package fluentd // import "github.com/docker/docker/daemon/logger/fluentd"
import (
"testing"
"gotest.tools/v3/assert"
)
func TestValidateLogOptReconnectInterval(t *testing.T) {
invalidIntervals := []string{"-1", "1", "-1s", "99ms", "11s"}
for _, v := range invalidIntervals {
t.Run("invalid "+v, func(t *testing.T) {
err := ValidateLogOpt(map[string]string{asyncReconnectIntervalKey: v})
assert.ErrorContains(t, err, "invalid value for fluentd-async-reconnect-interval:")
})
}
validIntervals := []string{"100ms", "10s"}
for _, v := range validIntervals {
t.Run("valid "+v, func(t *testing.T) {
err := ValidateLogOpt(map[string]string{asyncReconnectIntervalKey: v})
assert.NilError(t, err)
})
}
}