alertmanager/cli/check_config_test.go
Corentin Chary 25e4bb9965 amtool check-config (#978)
This is similar to `promtool check-config` and allows one
to validate the alertmanager configuration (as a git presubmit for example).

`govendor fetch github.com/spf13/{cobra,pflag}` was needed to
have support for `Args`.
2017-09-07 10:58:58 +02:00

18 lines
333 B
Go

package cli
import (
"testing"
)
func TestCheckConfig(t *testing.T) {
err := CheckConfig([]string{"testdata/conf.good.yml"})
if err != nil {
t.Fatalf("Checking valid config file failed with: %v", err)
}
err = CheckConfig([]string{"testdata/conf.bad.yml"})
if err == nil {
t.Fatalf("Failed to detect invalid file.")
}
}