Explorar el Código

tests: uses different paths depending on os

bergquist hace 7 años
padre
commit
3f5078339c
Se han modificado 1 ficheros con 7 adiciones y 4 borrados
  1. 7 4
      pkg/services/provisioning/dashboards/file_reader_test.go

+ 7 - 4
pkg/services/provisioning/dashboards/file_reader_test.go

@@ -49,13 +49,16 @@ func TestCreatingNewDashboardFileReader(t *testing.T) {
 		})
 		})
 
 
 		Convey("using full path", func() {
 		Convey("using full path", func() {
-			cfg.Options["folder"] = "/var/lib/grafana/dashboards"
+			fullPath := "/var/lib/grafana/dashboards"
+			if runtime.GOOS == "windows" {
+				fullPath = `c:\var\lib\grafana`
+			}
+
+			cfg.Options["folder"] = fullPath
 			reader, err := NewDashboardFileReader(cfg, log.New("test-logger"))
 			reader, err := NewDashboardFileReader(cfg, log.New("test-logger"))
 			So(err, ShouldBeNil)
 			So(err, ShouldBeNil)
 
 
-			if runtime.GOOS != "windows" {
-				So(reader.Path, ShouldEqual, "/var/lib/grafana/dashboards")
-			}
+			So(reader.Path, ShouldEqual, fullPath)
 			So(filepath.IsAbs(reader.Path), ShouldBeTrue)
 			So(filepath.IsAbs(reader.Path), ShouldBeTrue)
 		})
 		})