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

Merge pull request #1921 from elezar/move-source-pci-testdata

Move testdata to root
This commit is contained in:
Kubernetes Prow Robot 2024-10-22 14:22:52 +01:00 committed by GitHub
commit b9d7fa045d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
263 changed files with 2 additions and 9 deletions

View file

@ -18,7 +18,6 @@ package pci
import ( import (
"path/filepath" "path/filepath"
"runtime"
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
@ -27,13 +26,6 @@ import (
"sigs.k8s.io/node-feature-discovery/source" "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) { func TestSingletonPciSource(t *testing.T) {
assert.Equal(t, src.Name(), Name) assert.Equal(t, src.Name(), Name)
@ -232,7 +224,8 @@ func TestPciSource(t *testing.T) {
// Run test cases // Run test cases
for _, tc := range tests { for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) { 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 config := tc.config
if config == nil { if config == nil {

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