I’m seeing an error with the built-in test script for the setting module - but only under windows. It seems to be related to the forward-slash/back-slash ‘feature’ of windows, but so far, I haven’t been able to get to the exact root.
Specifically, running go run build.go test under linux works perfectly, but under windows, gives these 5 errors:
…x.xxx.
Failures:
* C:/Users/mdmoo/go/src/github.com/grafana/grafana/pkg/setting/setting_test.go
Line 60:
Expected: '/tmp/data'
Actual: '..\..\tmp\data'
(Should be equal)
* C:/Users/mdmoo/go/src/github.com/grafana/grafana/pkg/setting/setting_test.go
Line 83:
Expected: '/tmp/override'
Actual: '..\..\tmp\override'
(Should be equal)
* C:/Users/mdmoo/go/src/github.com/grafana/grafana/pkg/setting/setting_test.go
Line 93:
Expected: '/tmp/data'
Actual: '..\..\tmp\data'
(Should be equal)
* C:/Users/mdmoo/go/src/github.com/grafana/grafana/pkg/setting/setting_test.go
Line 103:
Expected: '/tmp/env_override'
Actual: '..\..\tmp\env_override'
(Should be equal)
16 total assertions
--- FAIL: TestLoadingSettings (0.24s)
FAIL
FAIL github.com/grafana/grafana/pkg/setting 0.381s
? github.com/grafana/grafana/pkg/social [no test files]
ok github.com/grafana/grafana/pkg/tsdb 0.473s
ok github.com/grafana/grafana/pkg/tsdb/graphite 0.101s
ok github.com/grafana/grafana/pkg/tsdb/influxdb 0.167s
ok github.com/grafana/grafana/pkg/tsdb/mqe 0.100s
ok github.com/grafana/grafana/pkg/tsdb/mysql 0.125s
ok github.com/grafana/grafana/pkg/tsdb/opentsdb 0.058s
ok github.com/grafana/grafana/pkg/tsdb/prometheus 0.052s
ok github.com/grafana/grafana/pkg/util 0.126s
exit status 1
exit status 1
I have a clue though. The problem seems to be that setting.go resolves the paths by calling makeAbsolute() which prepends the homepath. Hence the “…/…/” Why this doesn’t do the same thing under linux is a mystery.
The second issue is the translation from forward-slashes to back-slashes, which seems to imply that the file directories are being resolved by the OS, resetting the setting property. I don’t see where this happens though.