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:
commit
b9d7fa045d
263 changed files with 2 additions and 9 deletions
|
@ -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
Loading…
Reference in a new issue