Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientMock ¶
type ClientMock struct { // UnlockFunc mocks the Unlock method. UnlockFunc func(lockID string) ([]lock.LockStatus, error) // XLockFunc mocks the XLock method. XLockFunc func(resourceName string, lockID string, ld lock.LockDetails) error // contains filtered or unexported fields }
ClientMock is a mock implementation of dplock.Client.
func TestSomethingThatUsesClient(t *testing.T) { // make and configure a mocked dplock.Client mockedClient := &ClientMock{ UnlockFunc: func(lockID string) ([]lock.LockStatus, error) { panic("mock out the Unlock method") }, XLockFunc: func(resourceName string, lockID string, ld lock.LockDetails) error { panic("mock out the XLock method") }, } // use mockedClient in code that requires dplock.Client // and then make assertions. }
func (*ClientMock) Unlock ¶
func (mock *ClientMock) Unlock(lockID string) ([]lock.LockStatus, error)
Unlock calls UnlockFunc.
func (*ClientMock) UnlockCalls ¶
func (mock *ClientMock) UnlockCalls() []struct { LockID string }
UnlockCalls gets all the calls that were made to Unlock. Check the length with:
len(mockedClient.UnlockCalls())
func (*ClientMock) XLock ¶
func (mock *ClientMock) XLock(resourceName string, lockID string, ld lock.LockDetails) error
XLock calls XLockFunc.
func (*ClientMock) XLockCalls ¶
func (mock *ClientMock) XLockCalls() []struct { ResourceName string LockID string Ld lock.LockDetails }
XLockCalls gets all the calls that were made to XLock. Check the length with:
len(mockedClient.XLockCalls())
type PurgerMock ¶
type PurgerMock struct { // PurgeFunc mocks the Purge method. PurgeFunc func() ([]lock.LockStatus, error) // contains filtered or unexported fields }
PurgerMock is a mock implementation of dplock.Purger.
func TestSomethingThatUsesPurger(t *testing.T) { // make and configure a mocked dplock.Purger mockedPurger := &PurgerMock{ PurgeFunc: func() ([]lock.LockStatus, error) { panic("mock out the Purge method") }, } // use mockedPurger in code that requires dplock.Purger // and then make assertions. }
func (*PurgerMock) Purge ¶
func (mock *PurgerMock) Purge() ([]lock.LockStatus, error)
Purge calls PurgeFunc.
func (*PurgerMock) PurgeCalls ¶
func (mock *PurgerMock) PurgeCalls() []struct { }
PurgeCalls gets all the calls that were made to Purge. Check the length with:
len(mockedPurger.PurgeCalls())
Click to show internal directories.
Click to hide internal directories.