grafana/pkg/services/provisioning/dashboards/file_reader_symlink_test.go
Tania 744c1032ee
Provisioning: Fix dual write of folders (#80140)
* Provisioning: Store folders in folders table

* Solve linting issues

* Remove a comment
2024-01-10 16:48:28 +01:00

40 lines
777 B
Go

//go:build linux || darwin
// +build linux darwin
package dashboards
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/grafana/grafana/pkg/infra/log"
)
var (
symlinkedFolder = "testdata/test-dashboards/symlink"
)
func TestProvisionedSymlinkedFolder(t *testing.T) {
cfg := &config{
Name: "Default",
Type: "file",
OrgID: 1,
Folder: "",
Options: map[string]any{"path": symlinkedFolder},
}
reader, err := NewDashboardFileReader(cfg, log.New("test-logger"), nil, nil, nil)
if err != nil {
t.Error("expected err to be nil")
}
want, err := filepath.Abs(containingID)
require.NoError(t, err)
resolvedPath := reader.resolvedPath()
assert.Equal(t, want, resolvedPath)
}