2015-05-30 20:00:46 +00:00
|
|
|
package cluster_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/BurntSushi/toml"
|
|
|
|
"github.com/influxdb/influxdb/cluster"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestConfig_Parse(t *testing.T) {
|
|
|
|
// Parse configuration.
|
|
|
|
var c cluster.Config
|
|
|
|
if _, err := toml.Decode(`
|
|
|
|
shard-writer-timeout = "10s"
|
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.
|
2015-06-05 23:07:54 +00:00
|
|
|
if time.Duration(c.ShardWriterTimeout) != 10*time.Second {
|
2015-07-02 16:32:28 +00:00
|
|
|
t.Fatalf("unexpected shard-writer timeout: %s", c.ShardWriterTimeout)
|
|
|
|
} else 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
|
|
|
}
|
|
|
|
}
|