mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Fix golint issues in pkg/util/sysctl/testing
This commit is contained in:
parent
8b123b1f4f
commit
e55fc5656c
@ -234,7 +234,6 @@ pkg/util/procfs
|
|||||||
pkg/util/removeall
|
pkg/util/removeall
|
||||||
pkg/util/rlimit
|
pkg/util/rlimit
|
||||||
pkg/util/selinux
|
pkg/util/selinux
|
||||||
pkg/util/sysctl/testing
|
|
||||||
pkg/util/taints
|
pkg/util/taints
|
||||||
pkg/volume
|
pkg/volume
|
||||||
pkg/volume/azure_dd
|
pkg/volume/azure_dd
|
||||||
|
@ -22,19 +22,20 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/util/sysctl"
|
"k8s.io/kubernetes/pkg/util/sysctl"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fake is a map-backed implementation of sysctl.Interface, for testing/mocking
|
// Fake is a map-backed implementation of sysctl.Interface, for testing/mocking.
|
||||||
type fake struct {
|
type Fake struct {
|
||||||
Settings map[string]int
|
Settings map[string]int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFake() *fake {
|
// NewFake creates a fake sysctl implementation.
|
||||||
return &fake{
|
func NewFake() *Fake {
|
||||||
|
return &Fake{
|
||||||
Settings: make(map[string]int),
|
Settings: make(map[string]int),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSysctl returns the value for the specified sysctl setting
|
// GetSysctl returns the value for the specified sysctl setting.
|
||||||
func (m *fake) GetSysctl(sysctl string) (int, error) {
|
func (m *Fake) GetSysctl(sysctl string) (int, error) {
|
||||||
v, found := m.Settings[sysctl]
|
v, found := m.Settings[sysctl]
|
||||||
if !found {
|
if !found {
|
||||||
return -1, os.ErrNotExist
|
return -1, os.ErrNotExist
|
||||||
@ -42,10 +43,10 @@ func (m *fake) GetSysctl(sysctl string) (int, error) {
|
|||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSysctl modifies the specified sysctl flag to the new value
|
// SetSysctl modifies the specified sysctl flag to the new value.
|
||||||
func (m *fake) SetSysctl(sysctl string, newVal int) error {
|
func (m *Fake) SetSysctl(sysctl string, newVal int) error {
|
||||||
m.Settings[sysctl] = newVal
|
m.Settings[sysctl] = newVal
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = sysctl.Interface(&fake{})
|
var _ = sysctl.Interface(&Fake{})
|
||||||
|
Loading…
Reference in New Issue
Block a user