setting_test.go 615 B

1234567891011121314151617181920212223242526272829303132
  1. package setting
  2. import (
  3. "os"
  4. "path/filepath"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestLoadingSettings(t *testing.T) {
  9. WorkDir, _ = filepath.Abs("../../")
  10. Convey("Testing loading settings from ini file", t, func() {
  11. Convey("Given the default ini files", func() {
  12. NewConfigContext()
  13. So(AppName, ShouldEqual, "Grafana")
  14. So(AdminUser, ShouldEqual, "admin")
  15. })
  16. Convey("Should be able to override via environment variables", func() {
  17. os.Setenv("GF_SECURITY_ADMIN_USER", "superduper")
  18. NewConfigContext()
  19. So(AdminUser, ShouldEqual, "superduper")
  20. })
  21. })
  22. }