file_reader_linux_test.go 738 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // +build linux
  2. package dashboards
  3. import (
  4. "path/filepath"
  5. "testing"
  6. "github.com/grafana/grafana/pkg/log"
  7. )
  8. var (
  9. symlinkedFolder = "testdata/test-dashboards/symlink"
  10. )
  11. func TestProvsionedSymlinkedFolder(t *testing.T) {
  12. cfg := &DashboardsAsConfig{
  13. Name: "Default",
  14. Type: "file",
  15. OrgId: 1,
  16. Folder: "",
  17. Options: map[string]interface{}{"path": symlinkedFolder},
  18. }
  19. reader, err := NewDashboardFileReader(cfg, log.New("test-logger"))
  20. if err != nil {
  21. t.Error("expected err to be nil")
  22. }
  23. want, err := filepath.Abs(containingId)
  24. if err != nil {
  25. t.Errorf("expected err to be nil")
  26. }
  27. resolvedPath := reader.resolvedPath()
  28. if resolvedPath != want {
  29. t.Errorf("got %s want %s", resolvedPath, want)
  30. }
  31. }