mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
c2cad26ca9
* Disable default golangci-lint filter Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com> * Chore: Fix linter warnings Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
32 lines
536 B
Go
32 lines
536 B
Go
package fs
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestExists_NonExistent(t *testing.T) {
|
|
exists, err := Exists("non-existent")
|
|
require.NoError(t, err)
|
|
|
|
require.False(t, exists)
|
|
}
|
|
|
|
func TestExists_Existent(t *testing.T) {
|
|
f, err := ioutil.TempFile("", "")
|
|
require.NoError(t, err)
|
|
t.Cleanup(func() {
|
|
err := os.Remove(f.Name())
|
|
assert.NoError(t, err)
|
|
})
|
|
|
|
exists, err := Exists(f.Name())
|
|
require.NoError(t, err)
|
|
|
|
require.True(t, exists)
|
|
}
|