mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2024-11-22 00:08:11 +00:00
Regenerate mocks for formatting
Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
parent
bbb94be213
commit
2b5eeb8d24
@ -13,25 +13,25 @@ var _ Discover = &DiscoverMock{}
|
||||
|
||||
// DiscoverMock is a mock implementation of Discover.
|
||||
//
|
||||
// func TestSomethingThatUsesDiscover(t *testing.T) {
|
||||
// func TestSomethingThatUsesDiscover(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Discover
|
||||
// mockedDiscover := &DiscoverMock{
|
||||
// DevicesFunc: func() ([]Device, error) {
|
||||
// panic("mock out the Devices method")
|
||||
// },
|
||||
// HooksFunc: func() ([]Hook, error) {
|
||||
// panic("mock out the Hooks method")
|
||||
// },
|
||||
// MountsFunc: func() ([]Mount, error) {
|
||||
// panic("mock out the Mounts method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Discover
|
||||
// mockedDiscover := &DiscoverMock{
|
||||
// DevicesFunc: func() ([]Device, error) {
|
||||
// panic("mock out the Devices method")
|
||||
// },
|
||||
// HooksFunc: func() ([]Hook, error) {
|
||||
// panic("mock out the Hooks method")
|
||||
// },
|
||||
// MountsFunc: func() ([]Mount, error) {
|
||||
// panic("mock out the Mounts method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedDiscover in code that requires Discover
|
||||
// // and then make assertions.
|
||||
// // use mockedDiscover in code that requires Discover
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type DiscoverMock struct {
|
||||
// DevicesFunc mocks the Devices method.
|
||||
DevicesFunc func() ([]Device, error)
|
||||
@ -78,7 +78,8 @@ func (mock *DiscoverMock) Devices() ([]Device, error) {
|
||||
|
||||
// DevicesCalls gets all the calls that were made to Devices.
|
||||
// Check the length with:
|
||||
// len(mockedDiscover.DevicesCalls())
|
||||
//
|
||||
// len(mockedDiscover.DevicesCalls())
|
||||
func (mock *DiscoverMock) DevicesCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -108,7 +109,8 @@ func (mock *DiscoverMock) Hooks() ([]Hook, error) {
|
||||
|
||||
// HooksCalls gets all the calls that were made to Hooks.
|
||||
// Check the length with:
|
||||
// len(mockedDiscover.HooksCalls())
|
||||
//
|
||||
// len(mockedDiscover.HooksCalls())
|
||||
func (mock *DiscoverMock) HooksCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -138,7 +140,8 @@ func (mock *DiscoverMock) Mounts() ([]Mount, error) {
|
||||
|
||||
// MountsCalls gets all the calls that were made to Mounts.
|
||||
// Check the length with:
|
||||
// len(mockedDiscover.MountsCalls())
|
||||
//
|
||||
// len(mockedDiscover.MountsCalls())
|
||||
func (mock *DiscoverMock) MountsCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
|
@ -13,29 +13,23 @@ var _ Locator = &LocatorMock{}
|
||||
|
||||
// LocatorMock is a mock implementation of Locator.
|
||||
//
|
||||
// func TestSomethingThatUsesLocator(t *testing.T) {
|
||||
// func TestSomethingThatUsesLocator(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Locator
|
||||
// mockedLocator := &LocatorMock{
|
||||
// LocateFunc: func(s string) ([]string, error) {
|
||||
// panic("mock out the Locate method")
|
||||
// },
|
||||
// RelativeFunc: func(s string) (string, error) {
|
||||
// panic("mock out the Relative method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Locator
|
||||
// mockedLocator := &LocatorMock{
|
||||
// LocateFunc: func(s string) ([]string, error) {
|
||||
// panic("mock out the Locate method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedLocator in code that requires Locator
|
||||
// // and then make assertions.
|
||||
// // use mockedLocator in code that requires Locator
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type LocatorMock struct {
|
||||
// LocateFunc mocks the Locate method.
|
||||
LocateFunc func(s string) ([]string, error)
|
||||
|
||||
// RelativeFunc mocks the Relative method.
|
||||
RelativeFunc func(s string) (string, error)
|
||||
|
||||
// calls tracks calls to the methods.
|
||||
calls struct {
|
||||
// Locate holds details about calls to the Locate method.
|
||||
@ -43,14 +37,8 @@ type LocatorMock struct {
|
||||
// S is the s argument value.
|
||||
S string
|
||||
}
|
||||
// Relative holds details about calls to the Relative method.
|
||||
Relative []struct {
|
||||
// S is the s argument value.
|
||||
S string
|
||||
}
|
||||
}
|
||||
lockLocate sync.RWMutex
|
||||
lockRelative sync.RWMutex
|
||||
lockLocate sync.RWMutex
|
||||
}
|
||||
|
||||
// Locate calls LocateFunc.
|
||||
@ -75,7 +63,8 @@ func (mock *LocatorMock) Locate(s string) ([]string, error) {
|
||||
|
||||
// LocateCalls gets all the calls that were made to Locate.
|
||||
// Check the length with:
|
||||
// len(mockedLocator.LocateCalls())
|
||||
//
|
||||
// len(mockedLocator.LocateCalls())
|
||||
func (mock *LocatorMock) LocateCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
@ -87,38 +76,3 @@ func (mock *LocatorMock) LocateCalls() []struct {
|
||||
mock.lockLocate.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
||||
// Relative calls RelativeFunc.
|
||||
func (mock *LocatorMock) Relative(s string) (string, error) {
|
||||
callInfo := struct {
|
||||
S string
|
||||
}{
|
||||
S: s,
|
||||
}
|
||||
mock.lockRelative.Lock()
|
||||
mock.calls.Relative = append(mock.calls.Relative, callInfo)
|
||||
mock.lockRelative.Unlock()
|
||||
if mock.RelativeFunc == nil {
|
||||
var (
|
||||
sOut string
|
||||
errOut error
|
||||
)
|
||||
return sOut, errOut
|
||||
}
|
||||
return mock.RelativeFunc(s)
|
||||
}
|
||||
|
||||
// RelativeCalls gets all the calls that were made to Relative.
|
||||
// Check the length with:
|
||||
// len(mockedLocator.RelativeCalls())
|
||||
func (mock *LocatorMock) RelativeCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
var calls []struct {
|
||||
S string
|
||||
}
|
||||
mock.lockRelative.RLock()
|
||||
calls = mock.calls.Relative
|
||||
mock.lockRelative.RUnlock()
|
||||
return calls
|
||||
}
|
||||
|
@ -13,19 +13,19 @@ var _ Runtime = &RuntimeMock{}
|
||||
|
||||
// RuntimeMock is a mock implementation of Runtime.
|
||||
//
|
||||
// func TestSomethingThatUsesRuntime(t *testing.T) {
|
||||
// func TestSomethingThatUsesRuntime(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Runtime
|
||||
// mockedRuntime := &RuntimeMock{
|
||||
// ExecFunc: func(strings []string) error {
|
||||
// panic("mock out the Exec method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Runtime
|
||||
// mockedRuntime := &RuntimeMock{
|
||||
// ExecFunc: func(strings []string) error {
|
||||
// panic("mock out the Exec method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedRuntime in code that requires Runtime
|
||||
// // and then make assertions.
|
||||
// // use mockedRuntime in code that requires Runtime
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type RuntimeMock struct {
|
||||
// ExecFunc mocks the Exec method.
|
||||
ExecFunc func(strings []string) error
|
||||
@ -62,7 +62,8 @@ func (mock *RuntimeMock) Exec(strings []string) error {
|
||||
|
||||
// ExecCalls gets all the calls that were made to Exec.
|
||||
// Check the length with:
|
||||
// len(mockedRuntime.ExecCalls())
|
||||
//
|
||||
// len(mockedRuntime.ExecCalls())
|
||||
func (mock *RuntimeMock) ExecCalls() []struct {
|
||||
Strings []string
|
||||
} {
|
||||
|
@ -14,28 +14,28 @@ var _ Spec = &SpecMock{}
|
||||
|
||||
// SpecMock is a mock implementation of Spec.
|
||||
//
|
||||
// func TestSomethingThatUsesSpec(t *testing.T) {
|
||||
// func TestSomethingThatUsesSpec(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Spec
|
||||
// mockedSpec := &SpecMock{
|
||||
// FlushFunc: func() error {
|
||||
// panic("mock out the Flush method")
|
||||
// },
|
||||
// LoadFunc: func() (*specs.Spec, error) {
|
||||
// panic("mock out the Load method")
|
||||
// },
|
||||
// LookupEnvFunc: func(s string) (string, bool) {
|
||||
// panic("mock out the LookupEnv method")
|
||||
// },
|
||||
// ModifyFunc: func(specModifier SpecModifier) error {
|
||||
// panic("mock out the Modify method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Spec
|
||||
// mockedSpec := &SpecMock{
|
||||
// FlushFunc: func() error {
|
||||
// panic("mock out the Flush method")
|
||||
// },
|
||||
// LoadFunc: func() (*specs.Spec, error) {
|
||||
// panic("mock out the Load method")
|
||||
// },
|
||||
// LookupEnvFunc: func(s string) (string, bool) {
|
||||
// panic("mock out the LookupEnv method")
|
||||
// },
|
||||
// ModifyFunc: func(specModifier SpecModifier) error {
|
||||
// panic("mock out the Modify method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedSpec in code that requires Spec
|
||||
// // and then make assertions.
|
||||
// // use mockedSpec in code that requires Spec
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type SpecMock struct {
|
||||
// FlushFunc mocks the Flush method.
|
||||
FlushFunc func() error
|
||||
@ -92,7 +92,8 @@ func (mock *SpecMock) Flush() error {
|
||||
|
||||
// FlushCalls gets all the calls that were made to Flush.
|
||||
// Check the length with:
|
||||
// len(mockedSpec.FlushCalls())
|
||||
//
|
||||
// len(mockedSpec.FlushCalls())
|
||||
func (mock *SpecMock) FlushCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -122,7 +123,8 @@ func (mock *SpecMock) Load() (*specs.Spec, error) {
|
||||
|
||||
// LoadCalls gets all the calls that were made to Load.
|
||||
// Check the length with:
|
||||
// len(mockedSpec.LoadCalls())
|
||||
//
|
||||
// len(mockedSpec.LoadCalls())
|
||||
func (mock *SpecMock) LoadCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -155,7 +157,8 @@ func (mock *SpecMock) LookupEnv(s string) (string, bool) {
|
||||
|
||||
// LookupEnvCalls gets all the calls that were made to LookupEnv.
|
||||
// Check the length with:
|
||||
// len(mockedSpec.LookupEnvCalls())
|
||||
//
|
||||
// len(mockedSpec.LookupEnvCalls())
|
||||
func (mock *SpecMock) LookupEnvCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
@ -189,7 +192,8 @@ func (mock *SpecMock) Modify(specModifier SpecModifier) error {
|
||||
|
||||
// ModifyCalls gets all the calls that were made to Modify.
|
||||
// Check the length with:
|
||||
// len(mockedSpec.ModifyCalls())
|
||||
//
|
||||
// len(mockedSpec.ModifyCalls())
|
||||
func (mock *SpecMock) ModifyCalls() []struct {
|
||||
SpecModifier SpecModifier
|
||||
} {
|
||||
|
@ -13,22 +13,22 @@ var _ Constraint = &ConstraintMock{}
|
||||
|
||||
// ConstraintMock is a mock implementation of Constraint.
|
||||
//
|
||||
// func TestSomethingThatUsesConstraint(t *testing.T) {
|
||||
// func TestSomethingThatUsesConstraint(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Constraint
|
||||
// mockedConstraint := &ConstraintMock{
|
||||
// AssertFunc: func() error {
|
||||
// panic("mock out the Assert method")
|
||||
// },
|
||||
// StringFunc: func() string {
|
||||
// panic("mock out the String method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Constraint
|
||||
// mockedConstraint := &ConstraintMock{
|
||||
// AssertFunc: func() error {
|
||||
// panic("mock out the Assert method")
|
||||
// },
|
||||
// StringFunc: func() string {
|
||||
// panic("mock out the String method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedConstraint in code that requires Constraint
|
||||
// // and then make assertions.
|
||||
// // use mockedConstraint in code that requires Constraint
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type ConstraintMock struct {
|
||||
// AssertFunc mocks the Assert method.
|
||||
AssertFunc func() error
|
||||
@ -67,7 +67,8 @@ func (mock *ConstraintMock) Assert() error {
|
||||
|
||||
// AssertCalls gets all the calls that were made to Assert.
|
||||
// Check the length with:
|
||||
// len(mockedConstraint.AssertCalls())
|
||||
//
|
||||
// len(mockedConstraint.AssertCalls())
|
||||
func (mock *ConstraintMock) AssertCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -96,7 +97,8 @@ func (mock *ConstraintMock) String() string {
|
||||
|
||||
// StringCalls gets all the calls that were made to String.
|
||||
// Check the length with:
|
||||
// len(mockedConstraint.StringCalls())
|
||||
//
|
||||
// len(mockedConstraint.StringCalls())
|
||||
func (mock *ConstraintMock) StringCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
|
@ -13,31 +13,31 @@ var _ Property = &PropertyMock{}
|
||||
|
||||
// PropertyMock is a mock implementation of Property.
|
||||
//
|
||||
// func TestSomethingThatUsesProperty(t *testing.T) {
|
||||
// func TestSomethingThatUsesProperty(t *testing.T) {
|
||||
//
|
||||
// // make and configure a mocked Property
|
||||
// mockedProperty := &PropertyMock{
|
||||
// CompareToFunc: func(s string) (int, error) {
|
||||
// panic("mock out the CompareTo method")
|
||||
// },
|
||||
// NameFunc: func() string {
|
||||
// panic("mock out the Name method")
|
||||
// },
|
||||
// StringFunc: func() string {
|
||||
// panic("mock out the String method")
|
||||
// },
|
||||
// ValidateFunc: func(s string) error {
|
||||
// panic("mock out the Validate method")
|
||||
// },
|
||||
// ValueFunc: func() (string, error) {
|
||||
// panic("mock out the Value method")
|
||||
// },
|
||||
// }
|
||||
// // make and configure a mocked Property
|
||||
// mockedProperty := &PropertyMock{
|
||||
// CompareToFunc: func(s string) (int, error) {
|
||||
// panic("mock out the CompareTo method")
|
||||
// },
|
||||
// NameFunc: func() string {
|
||||
// panic("mock out the Name method")
|
||||
// },
|
||||
// StringFunc: func() string {
|
||||
// panic("mock out the String method")
|
||||
// },
|
||||
// ValidateFunc: func(s string) error {
|
||||
// panic("mock out the Validate method")
|
||||
// },
|
||||
// ValueFunc: func() (string, error) {
|
||||
// panic("mock out the Value method")
|
||||
// },
|
||||
// }
|
||||
//
|
||||
// // use mockedProperty in code that requires Property
|
||||
// // and then make assertions.
|
||||
// // use mockedProperty in code that requires Property
|
||||
// // and then make assertions.
|
||||
//
|
||||
// }
|
||||
// }
|
||||
type PropertyMock struct {
|
||||
// CompareToFunc mocks the CompareTo method.
|
||||
CompareToFunc func(s string) (int, error)
|
||||
@ -105,7 +105,8 @@ func (mock *PropertyMock) CompareTo(s string) (int, error) {
|
||||
|
||||
// CompareToCalls gets all the calls that were made to CompareTo.
|
||||
// Check the length with:
|
||||
// len(mockedProperty.CompareToCalls())
|
||||
//
|
||||
// len(mockedProperty.CompareToCalls())
|
||||
func (mock *PropertyMock) CompareToCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
@ -136,7 +137,8 @@ func (mock *PropertyMock) Name() string {
|
||||
|
||||
// NameCalls gets all the calls that were made to Name.
|
||||
// Check the length with:
|
||||
// len(mockedProperty.NameCalls())
|
||||
//
|
||||
// len(mockedProperty.NameCalls())
|
||||
func (mock *PropertyMock) NameCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -165,7 +167,8 @@ func (mock *PropertyMock) String() string {
|
||||
|
||||
// StringCalls gets all the calls that were made to String.
|
||||
// Check the length with:
|
||||
// len(mockedProperty.StringCalls())
|
||||
//
|
||||
// len(mockedProperty.StringCalls())
|
||||
func (mock *PropertyMock) StringCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
@ -197,7 +200,8 @@ func (mock *PropertyMock) Validate(s string) error {
|
||||
|
||||
// ValidateCalls gets all the calls that were made to Validate.
|
||||
// Check the length with:
|
||||
// len(mockedProperty.ValidateCalls())
|
||||
//
|
||||
// len(mockedProperty.ValidateCalls())
|
||||
func (mock *PropertyMock) ValidateCalls() []struct {
|
||||
S string
|
||||
} {
|
||||
@ -229,7 +233,8 @@ func (mock *PropertyMock) Value() (string, error) {
|
||||
|
||||
// ValueCalls gets all the calls that were made to Value.
|
||||
// Check the length with:
|
||||
// len(mockedProperty.ValueCalls())
|
||||
//
|
||||
// len(mockedProperty.ValueCalls())
|
||||
func (mock *PropertyMock) ValueCalls() []struct {
|
||||
} {
|
||||
var calls []struct {
|
||||
|
Loading…
Reference in New Issue
Block a user