github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/ruler/pusher_mock_test.go (about) 1 package ruler 2 3 import ( 4 "context" 5 6 "github.com/stretchr/testify/mock" 7 8 "github.com/cortexproject/cortex/pkg/cortexpb" 9 ) 10 11 type pusherMock struct { 12 mock.Mock 13 } 14 15 func newPusherMock() *pusherMock { 16 return &pusherMock{} 17 } 18 19 func (m *pusherMock) Push(ctx context.Context, req *cortexpb.WriteRequest) (*cortexpb.WriteResponse, error) { 20 args := m.Called(ctx, req) 21 return args.Get(0).(*cortexpb.WriteResponse), args.Error(1) 22 } 23 24 func (m *pusherMock) MockPush(res *cortexpb.WriteResponse, err error) { 25 m.On("Push", mock.Anything, mock.Anything).Return(res, err) 26 }