Merge pull request #18519 from alliasgher/fix-testfstype-unknown-fs

util/runtime: let TestFsType tolerate filesystems absent from FsType map
This commit is contained in:
Julien
2026-04-15 14:12:13 +02:00
committed by GitHub

View File

@@ -19,20 +19,18 @@ import (
"os"
"testing"
"github.com/grafana/regexp"
"github.com/stretchr/testify/require"
)
var regexpFsType = regexp.MustCompile("^[A-Z][A-Z0-9_]*_MAGIC$")
func TestFsType(t *testing.T) {
var fsType string
path, err := os.Getwd()
require.NoError(t, err)
// A real path must yield a non-zero filesystem type.
fsType = FsType(path)
require.Regexp(t, regexpFsType, fsType)
require.NotEqual(t, "0", fsType)
fsType = FsType("/no/where/to/be/found")
require.Equal(t, "0", fsType)