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

36 lines
704 B
Go
Raw Normal View History

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