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(`
|
2015-07-02 16:32:28 +00:00
|
|
|
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 {
|
2015-07-02 16:32:28 +00:00
|
|
|
t.Fatalf("unexpected write timeout s: %s", c.WriteTimeout)
|
2015-05-30 20:00:46 +00:00
|
|
|
}
|
|
|
|
}
|