Browse Source

feat(alerting/annotations): fixed broken test

Torkel Ödegaard 9 years ago
parent
commit
23de094a81
2 changed files with 8 additions and 6 deletions
  1. 2 1
      pkg/metrics/graphite_test.go
  2. 6 5
      pkg/setting/setting.go

+ 2 - 1
pkg/metrics/graphite_test.go

@@ -10,6 +10,8 @@ import (
 
 func TestGraphitePublisher(t *testing.T) {
 
+	setting.CustomInitPath = "conf/does_not_exist.ini"
+
 	Convey("Test graphite prefix replacement", t, func() {
 		var err error
 		err = setting.NewConfigContext(&setting.CommandLineArgs{
@@ -67,7 +69,6 @@ func TestGraphitePublisher(t *testing.T) {
 
 		_, err = setting.Cfg.NewSection("metrics.graphite")
 
-		setting.InstanceName = "hostname.with.dots.com"
 		publisher, err := CreateGraphitePublisher()
 
 		So(err, ShouldBeNil)

+ 6 - 5
pkg/setting/setting.go

@@ -47,10 +47,11 @@ var (
 	BuildStamp   int64
 
 	// Paths
-	LogsPath    string
-	HomePath    string
-	DataPath    string
-	PluginsPath string
+	LogsPath       string
+	HomePath       string
+	DataPath       string
+	PluginsPath    string
+	CustomInitPath = "conf/custom.ini"
 
 	// Log settings.
 	LogModes   []string
@@ -312,7 +313,7 @@ func evalConfigValues() {
 
 func loadSpecifedConfigFile(configFile string) error {
 	if configFile == "" {
-		configFile = filepath.Join(HomePath, "conf/custom.ini")
+		configFile = filepath.Join(HomePath, CustomInitPath)
 		// return without error if custom file does not exist
 		if !pathExists(configFile) {
 			return nil