conf_test.go 874 B

123456789101112131415161718192021222324252627282930313233
  1. package conf
  2. import (
  3. "flag"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func init() {
  8. var err error
  9. flag.Set("conf", "../cmd/saga-test.toml")
  10. if err = Init(); err != nil {
  11. panic(err)
  12. }
  13. }
  14. func TestConf(t *testing.T) {
  15. Convey("test conf", t, func() {
  16. So(Conf, ShouldNotBeNil)
  17. So(Conf.Property, ShouldNotBeNil)
  18. So(Conf.Property.Gitlab, ShouldNotBeNil)
  19. So(Conf.Property.Repos, ShouldNotBeNil)
  20. So(Conf.Property.Repos[0].MinReviewer, ShouldEqual, 1)
  21. So(Conf.Property.Repos[1].MinReviewer, ShouldEqual, 0)
  22. So(Conf.Property.Repos[0].AuthBranches[0], ShouldEqual, "master")
  23. So(Conf.Property.Repos[1].AuthBranches[0], ShouldEqual, "master")
  24. So(Conf.Property.Mail, ShouldNotBeNil)
  25. So(Conf.Property.HealthCheck, ShouldNotBeNil)
  26. So(Conf.Property.HealthCheck.AlertAddrs, ShouldNotBeEmpty)
  27. So(Conf.Property.Wechat, ShouldNotBeNil)
  28. })
  29. }