Skip to content

Commit b6b1335

Browse files
committed
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 <[email protected]>
1 parent 91f631b commit b6b1335

File tree

263 files changed

+2
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+2
-9
lines changed

source/pci/pci_test.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package pci
1818

1919
import (
2020
"path/filepath"
21-
"runtime"
2221
"testing"
2322

2423
"github.com/stretchr/testify/assert"
@@ -27,13 +26,6 @@ import (
2726
"sigs.k8s.io/node-feature-discovery/source"
2827
)
2928

30-
var packagePath string
31-
32-
func init() {
33-
_, thisFile, _, _ := runtime.Caller(0)
34-
packagePath = filepath.Dir(thisFile)
35-
}
36-
3729
func TestSingletonPciSource(t *testing.T) {
3830
assert.Equal(t, src.Name(), Name)
3931

@@ -232,7 +224,8 @@ func TestPciSource(t *testing.T) {
232224
// Run test cases
233225
for _, tc := range tests {
234226
t.Run(tc.name, func(t *testing.T) {
235-
hostpath.SysfsDir = hostpath.HostDir(filepath.Join(packagePath, "testdata", tc.rootfs, "sys"))
227+
mockSysfsPath := filepath.Join("..", "..", "testdata", "source", "pci", tc.rootfs, "sys")
228+
hostpath.SysfsDir = hostpath.HostDir(mockSysfsPath)
236229

237230
config := tc.config
238231
if config == nil {

0 commit comments

Comments
 (0)