1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

Move testdata to root

Go mod automatically ignores the /testdata directory.
This change ensures that the rootfs for source/pci tests are not
included in the module definition.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2024-10-21 16:49:32 +02:00
parent 91f631b116
commit b6b1335ec1
263 changed files with 2 additions and 9 deletions

View file

@ -18,7 +18,6 @@ package pci
import (
"path/filepath"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
@ -27,13 +26,6 @@ import (
"sigs.k8s.io/node-feature-discovery/source"
)
var packagePath string
func init() {
_, thisFile, _, _ := runtime.Caller(0)
packagePath = filepath.Dir(thisFile)
}
func TestSingletonPciSource(t *testing.T) {
assert.Equal(t, src.Name(), Name)
@ -232,7 +224,8 @@ func TestPciSource(t *testing.T) {
// Run test cases
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
hostpath.SysfsDir = hostpath.HostDir(filepath.Join(packagePath, "testdata", tc.rootfs, "sys"))
mockSysfsPath := filepath.Join("..", "..", "testdata", "source", "pci", tc.rootfs, "sys")
hostpath.SysfsDir = hostpath.HostDir(mockSysfsPath)
config := tc.config
if config == nil {

Some files were not shown because too many files have changed in this diff Show more