Exemplo n.º 1
0
func TestServiceConstructor(t *testing.T) {

	config := retention.NewConfig()

	s := retention.NewService(config)
	if err := s.Open(); err != nil {
		t.Fatal(err)
	}
	defer s.Close()
}
Exemplo n.º 2
0
func TestServiceSettingLogger(t *testing.T) {

	config := retention.NewConfig()
	s := retention.NewService(config)

	logger := log.New(os.Stderr, "[retention] ", log.LstdFlags)
	s.SetLogger(logger)
	if s.Logger() != logger {
		t.Fatalf("unexpected logger state: %v", s.Logger())
	}

}
Exemplo n.º 3
0
func TestConfig_Parse(t *testing.T) {
	// Parse configuration.
	c := retention.NewConfig()

	if _, err := toml.Decode(`
enabled = true
check-interval = "1s"
`, &c); err != nil {
		t.Fatal(err)
	}

	// Validate configuration.
	if c.Enabled != true {
		t.Fatalf("unexpected enabled state: %v", c.Enabled)
	} else if time.Duration(c.CheckInterval) != time.Second {
		t.Fatalf("unexpected check interval: %v", c.CheckInterval)
	}
}
Exemplo n.º 4
0
// NewConfig returns an instance of Config with reasonable defaults.
func NewConfig() *Config {
	c := &Config{}
	c.Meta = meta.NewConfig()
	c.Data = db.NewConfig()
	c.Cluster = cluster.NewConfig()
	// c.Precreator = precreator.NewConfig()

	c.Admin = admin.NewConfig()
	c.HTTPD = httpd.NewConfig()
	// c.Collectd = collectd.NewConfig()
	// c.OpenTSDB = opentsdb.NewConfig()
	// c.Graphites = append(c.Graphites, graphite.NewConfig())

	// c.Monitoring = monitor.NewConfig()
	// c.ContinuousQuery = continuous_querier.NewConfig()
	c.Retention = retention.NewConfig()
	c.HintedHandoff = hh.NewConfig()

	return c
}