Documentation
¶
Index ¶
- type RedisMock
- func (mock *RedisMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
- func (mock *RedisMock) CheckerCalls() []struct{ ... }
- func (mock *RedisMock) DeleteValue(ctx context.Context, key string) error
- func (mock *RedisMock) DeleteValueCalls() []struct{ ... }
- func (mock *RedisMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
- func (mock *RedisMock) GetKeyValuePairsCalls() []struct{ ... }
- func (mock *RedisMock) GetTotalKeys(ctx context.Context) (int64, error)
- func (mock *RedisMock) GetTotalKeysCalls() []struct{ ... }
- func (mock *RedisMock) GetValue(ctx context.Context, key string) (string, error)
- func (mock *RedisMock) GetValueCalls() []struct{ ... }
- func (mock *RedisMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (mock *RedisMock) SetValueCalls() []struct{ ... }
- type StorerMock
- func (mock *StorerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (mock *StorerMock) CheckerCalls() []struct{ ... }
- func (mock *StorerMock) DeleteValue(ctx context.Context, key string) error
- func (mock *StorerMock) DeleteValueCalls() []struct{ ... }
- func (mock *StorerMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
- func (mock *StorerMock) GetKeyValuePairsCalls() []struct{ ... }
- func (mock *StorerMock) GetTotalKeys(ctx context.Context) (int64, error)
- func (mock *StorerMock) GetTotalKeysCalls() []struct{ ... }
- func (mock *StorerMock) GetValue(ctx context.Context, key string) (string, error)
- func (mock *StorerMock) GetValueCalls() []struct{ ... }
- func (mock *StorerMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
- func (mock *StorerMock) SetValueCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RedisMock ¶
type RedisMock struct {
// CheckerFunc mocks the Checker method.
CheckerFunc func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
// DeleteValueFunc mocks the DeleteValue method.
DeleteValueFunc func(ctx context.Context, key string) error
// GetKeyValuePairsFunc mocks the GetKeyValuePairs method.
GetKeyValuePairsFunc func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
// GetTotalKeysFunc mocks the GetTotalKeys method.
GetTotalKeysFunc func(ctx context.Context) (int64, error)
// GetValueFunc mocks the GetValue method.
GetValueFunc func(ctx context.Context, key string) (string, error)
// SetValueFunc mocks the SetValue method.
SetValueFunc func(ctx context.Context, key string, value interface{}, expiration time.Duration) error
// contains filtered or unexported fields
}
RedisMock is a mock implementation of store.Redis.
func TestSomethingThatUsesRedis(t *testing.T) {
// make and configure a mocked store.Redis
mockedRedis := &RedisMock{
CheckerFunc: func(contextMoqParam context.Context, checkState *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
DeleteValueFunc: func(ctx context.Context, key string) error {
panic("mock out the DeleteValue method")
},
GetKeyValuePairsFunc: func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error) {
panic("mock out the GetKeyValuePairs method")
},
GetTotalKeysFunc: func(ctx context.Context) (int64, error) {
panic("mock out the GetTotalKeys method")
},
GetValueFunc: func(ctx context.Context, key string) (string, error) {
panic("mock out the GetValue method")
},
SetValueFunc: func(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
panic("mock out the SetValue method")
},
}
// use mockedRedis in code that requires store.Redis
// and then make assertions.
}
func (*RedisMock) Checker ¶
func (mock *RedisMock) Checker(contextMoqParam context.Context, checkState *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*RedisMock) CheckerCalls ¶
func (mock *RedisMock) CheckerCalls() []struct { ContextMoqParam context.Context CheckState *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedRedis.CheckerCalls())
func (*RedisMock) DeleteValue ¶ added in v0.3.3
DeleteValue calls DeleteValueFunc.
func (*RedisMock) DeleteValueCalls ¶ added in v0.3.3
DeleteValueCalls gets all the calls that were made to DeleteValue. Check the length with:
len(mockedRedis.DeleteValueCalls())
func (*RedisMock) GetKeyValuePairs ¶ added in v0.3.5
func (mock *RedisMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
GetKeyValuePairs calls GetKeyValuePairsFunc.
func (*RedisMock) GetKeyValuePairsCalls ¶ added in v0.3.5
func (mock *RedisMock) GetKeyValuePairsCalls() []struct { Ctx context.Context MatchPattern string Count int64 Cursor uint64 }
GetKeyValuePairsCalls gets all the calls that were made to GetKeyValuePairs. Check the length with:
len(mockedRedis.GetKeyValuePairsCalls())
func (*RedisMock) GetTotalKeys ¶ added in v0.3.5
GetTotalKeys calls GetTotalKeysFunc.
func (*RedisMock) GetTotalKeysCalls ¶ added in v0.3.5
GetTotalKeysCalls gets all the calls that were made to GetTotalKeys. Check the length with:
len(mockedRedis.GetTotalKeysCalls())
func (*RedisMock) GetValueCalls ¶
GetValueCalls gets all the calls that were made to GetValue. Check the length with:
len(mockedRedis.GetValueCalls())
type StorerMock ¶
type StorerMock struct {
// CheckerFunc mocks the Checker method.
CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error
// DeleteValueFunc mocks the DeleteValue method.
DeleteValueFunc func(ctx context.Context, key string) error
// GetKeyValuePairsFunc mocks the GetKeyValuePairs method.
GetKeyValuePairsFunc func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
// GetTotalKeysFunc mocks the GetTotalKeys method.
GetTotalKeysFunc func(ctx context.Context) (int64, error)
// GetValueFunc mocks the GetValue method.
GetValueFunc func(ctx context.Context, key string) (string, error)
// SetValueFunc mocks the SetValue method.
SetValueFunc func(ctx context.Context, key string, value interface{}, expiration time.Duration) error
// contains filtered or unexported fields
}
StorerMock is a mock implementation of store.Storer.
func TestSomethingThatUsesStorer(t *testing.T) {
// make and configure a mocked store.Storer
mockedStorer := &StorerMock{
CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
DeleteValueFunc: func(ctx context.Context, key string) error {
panic("mock out the DeleteValue method")
},
GetKeyValuePairsFunc: func(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error) {
panic("mock out the GetKeyValuePairs method")
},
GetTotalKeysFunc: func(ctx context.Context) (int64, error) {
panic("mock out the GetTotalKeys method")
},
GetValueFunc: func(ctx context.Context, key string) (string, error) {
panic("mock out the GetValue method")
},
SetValueFunc: func(ctx context.Context, key string, value interface{}, expiration time.Duration) error {
panic("mock out the SetValue method")
},
}
// use mockedStorer in code that requires store.Storer
// and then make assertions.
}
func (*StorerMock) Checker ¶
func (mock *StorerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*StorerMock) CheckerCalls ¶
func (mock *StorerMock) CheckerCalls() []struct { Ctx context.Context State *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedStorer.CheckerCalls())
func (*StorerMock) DeleteValue ¶ added in v0.3.3
func (mock *StorerMock) DeleteValue(ctx context.Context, key string) error
DeleteValue calls DeleteValueFunc.
func (*StorerMock) DeleteValueCalls ¶ added in v0.3.3
func (mock *StorerMock) DeleteValueCalls() []struct { Ctx context.Context Key string }
DeleteValueCalls gets all the calls that were made to DeleteValue. Check the length with:
len(mockedStorer.DeleteValueCalls())
func (*StorerMock) GetKeyValuePairs ¶ added in v0.3.5
func (mock *StorerMock) GetKeyValuePairs(ctx context.Context, matchPattern string, count int64, cursor uint64) (map[string]string, uint64, error)
GetKeyValuePairs calls GetKeyValuePairsFunc.
func (*StorerMock) GetKeyValuePairsCalls ¶ added in v0.3.5
func (mock *StorerMock) GetKeyValuePairsCalls() []struct { Ctx context.Context MatchPattern string Count int64 Cursor uint64 }
GetKeyValuePairsCalls gets all the calls that were made to GetKeyValuePairs. Check the length with:
len(mockedStorer.GetKeyValuePairsCalls())
func (*StorerMock) GetTotalKeys ¶ added in v0.3.5
func (mock *StorerMock) GetTotalKeys(ctx context.Context) (int64, error)
GetTotalKeys calls GetTotalKeysFunc.
func (*StorerMock) GetTotalKeysCalls ¶ added in v0.3.5
func (mock *StorerMock) GetTotalKeysCalls() []struct { Ctx context.Context }
GetTotalKeysCalls gets all the calls that were made to GetTotalKeys. Check the length with:
len(mockedStorer.GetTotalKeysCalls())
func (*StorerMock) GetValueCalls ¶
func (mock *StorerMock) GetValueCalls() []struct { Ctx context.Context Key string }
GetValueCalls gets all the calls that were made to GetValue. Check the length with:
len(mockedStorer.GetValueCalls())
func (*StorerMock) SetValue ¶ added in v0.3.2
func (mock *StorerMock) SetValue(ctx context.Context, key string, value interface{}, expiration time.Duration) error
SetValue calls SetValueFunc.
func (*StorerMock) SetValueCalls ¶ added in v0.3.2
func (mock *StorerMock) SetValueCalls() []struct { Ctx context.Context Key string Value interface{} Expiration time.Duration }
SetValueCalls gets all the calls that were made to SetValue. Check the length with:
len(mockedStorer.SetValueCalls())