Files
grafana/pkg/services/provisioning/dashboards/file_reader_linux_test.go
T

36 lines
709 B
Go
Raw Normal View History

2018-05-21 09:03:32 +02:00
// +build linux
package dashboards
import (
"path/filepath"
"testing"
2019-05-13 14:45:54 +08:00
"github.com/grafana/grafana/pkg/infra/log"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
2018-05-21 09:03:32 +02:00
)
var (
symlinkedFolder = "testdata/test-dashboards/symlink"
)
func TestProvisionedSymlinkedFolder(t *testing.T) {
2020-04-16 05:46:20 +02:00
cfg := &config{
2018-05-21 09:03:32 +02:00
Name: "Default",
Type: "file",
2020-04-16 05:46:20 +02:00
OrgID: 1,
2018-05-21 09:03:32 +02:00
Folder: "",
Options: map[string]interface{}{"path": symlinkedFolder},
}
reader, err := NewDashboardFileReader(cfg, log.New("test-logger"), nil)
require.NoError(t, err)
2018-05-21 09:03:32 +02:00
want, err := filepath.Abs(containingID)
require.NoError(t, err)
2018-05-21 09:03:32 +02:00
resolvedPath := reader.resolvedPath()
assert.Equal(t, want, resolvedPath)
2018-05-21 09:03:32 +02:00
}