influxdb/coordinator/config_test.go

25 lines
461 B
Go
Raw Normal View History

2016-05-11 16:32:56 +00:00
package coordinator_test
2015-05-30 20:00:46 +00:00
import (
"testing"
"time"
"github.com/BurntSushi/toml"
2016-05-11 16:32:56 +00:00
"github.com/influxdata/influxdb/coordinator"
2015-05-30 20:00:46 +00:00
)
func TestConfig_Parse(t *testing.T) {
// Parse configuration.
2016-05-11 16:32:56 +00:00
var c coordinator.Config
2015-05-30 20:00:46 +00:00
if _, err := toml.Decode(`
write-timeout = "20s"
2015-05-30 20:00:46 +00:00
`, &c); err != nil {
t.Fatal(err)
}
// Validate configuration.
2016-05-11 18:59:30 +00:00
if time.Duration(c.WriteTimeout) != 20*time.Second {
t.Fatalf("unexpected write timeout s: %s", c.WriteTimeout)
2015-05-30 20:00:46 +00:00
}
}