mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-05 08:17:04 +00:00
source: make per-source unit tests stricter
Now the tests check that GetLabels() works even without calling Discover() at all.
This commit is contained in:
parent
14ab512588
commit
a5e2d4ca16
9 changed files with 9 additions and 18 deletions
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCpuSource(t *testing.T) {
|
func TestCpuSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestKernelSource(t *testing.T) {
|
func TestKernelSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestLocalSource(t *testing.T) {
|
func TestLocalSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMemorySource(t *testing.T) {
|
func TestMemorySource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkSource(t *testing.T) {
|
func TestNetworkSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestPciSource(t *testing.T) {
|
func TestPciSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestStorageSource(t *testing.T) {
|
func TestStorageSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSystemSource(t *testing.T) {
|
func TestSystemSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
|
@ -20,14 +20,13 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"sigs.k8s.io/node-feature-discovery/pkg/api/feature"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUsbSource(t *testing.T) {
|
func TestUsbSource(t *testing.T) {
|
||||||
assert.Equal(t, src.Name(), Name)
|
assert.Equal(t, src.Name(), Name)
|
||||||
|
|
||||||
// Check that GetLabels works with empty features
|
// Check that GetLabels works with empty features
|
||||||
src.features = feature.NewDomainFeatures()
|
src.features = nil
|
||||||
l, err := src.GetLabels()
|
l, err := src.GetLabels()
|
||||||
|
|
||||||
assert.Nil(t, err, err)
|
assert.Nil(t, err, err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue