file_reader_linux_test.go 698 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 nill")
  26. }
  27. if reader.Path != want {
  28. t.Errorf("got %s want %s", reader.Path, want)
  29. }
  30. }