1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-15 17:50:49 +00:00

nfd-worker: lint fixes

This commit is contained in:
Markus Lehtonen 2020-05-19 14:57:39 +03:00
parent 4e04d1d61c
commit 91f3ddcc45
2 changed files with 5 additions and 6 deletions

View file

@ -39,12 +39,10 @@ func TestDiscoveryWithMockSources(t *testing.T) {
fakeFeatureNames := []string{"testfeature1", "testfeature2", "testfeature3"}
fakeFeatures := source.Features{}
fakeFeatureLabels := Labels{}
fakeFeatureLabelNames := make([]string, 0, len(fakeFeatureNames))
for _, f := range fakeFeatureNames {
fakeFeatures[f] = true
labelName := fakeFeatureSourceName + "-" + f
fakeFeatureLabels[labelName] = "true"
fakeFeatureLabelNames = append(fakeFeatureLabelNames, labelName)
}
fakeFeatureSource := source.FeatureSource(mockFeatureSource)
@ -89,7 +87,7 @@ func TestConfigParse(t *testing.T) {
f, err := ioutil.TempFile("", "nfd-test-")
defer os.Remove(f.Name())
So(err, ShouldBeNil)
f.WriteString(`sources:
_, err = f.WriteString(`sources:
kernel:
configOpts:
- "DMI"
@ -97,6 +95,7 @@ func TestConfigParse(t *testing.T) {
deviceClassWhitelist:
- "ff"`)
f.Close()
So(err, ShouldBeNil)
Convey("When proper config file is given", func() {
err := configParse(f.Name(), "")

View file

@ -60,7 +60,7 @@ var (
// Global config
type NFDConfig struct {
Sources struct {
Cpu *cpu.NFDConfig `json:"cpu,omitempty"`
CPU *cpu.NFDConfig `json:"cpu,omitempty"`
Kernel *kernel.NFDConfig `json:"kernel,omitempty"`
Pci *pci.NFDConfig `json:"pci,omitempty"`
Usb *usb.NFDConfig `json:"usb,omitempty"`
@ -100,7 +100,7 @@ type nfdWorker struct {
}
// Create new NfdWorker instance.
func NewNfdWorker(args Args) (*nfdWorker, error) {
func NewNfdWorker(args Args) (NfdWorker, error) {
nfd := &nfdWorker{args: args}
if args.SleepInterval > 0 && args.SleepInterval < time.Second {
stderrLogger.Printf("WARNING: too short sleep-intervall specified (%s), forcing to 1s", args.SleepInterval.String())
@ -235,7 +235,7 @@ func (w *nfdWorker) disconnect() {
// Parse configuration options
func configParse(filepath string, overrides string) error {
config.Sources.Cpu = &cpu.Config
config.Sources.CPU = &cpu.Config
config.Sources.Kernel = &kernel.Config
config.Sources.Pci = &pci.Config
config.Sources.Usb = &usb.Config