mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Add mocks and interfaces for testing SQS rendezvous
Co-authored-by: Michael Pu <michael.pu@uwaterloo.ca>
This commit is contained in:
parent
8fb17de152
commit
f3b062ddb2
7 changed files with 262 additions and 4 deletions
18
common/sqsclient/sqsclient.go
Normal file
18
common/sqsclient/sqsclient.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package sqsclient
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/service/sqs"
|
||||
)
|
||||
|
||||
type SQSClient interface {
|
||||
ReceiveMessage(ctx context.Context, input *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)
|
||||
ListQueues(ctx context.Context, input *sqs.ListQueuesInput, optFns ...func(*sqs.Options)) (*sqs.ListQueuesOutput, error)
|
||||
GetQueueAttributes(ctx context.Context, input *sqs.GetQueueAttributesInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueAttributesOutput, error)
|
||||
DeleteQueue(ctx context.Context, input *sqs.DeleteQueueInput, optFns ...func(*sqs.Options)) (*sqs.DeleteQueueOutput, error)
|
||||
CreateQueue(ctx context.Context, input *sqs.CreateQueueInput, optFns ...func(*sqs.Options)) (*sqs.CreateQueueOutput, error)
|
||||
SendMessage(ctx context.Context, input *sqs.SendMessageInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)
|
||||
DeleteMessage(ctx context.Context, input *sqs.DeleteMessageInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error)
|
||||
GetQueueUrl(ctx context.Context, input *sqs.GetQueueUrlInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error)
|
||||
}
|
196
common/sqsclient/sqsclient_mock.go
Normal file
196
common/sqsclient/sqsclient_mock.go
Normal file
|
@ -0,0 +1,196 @@
|
|||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: common/sqsclient/sqsclient.go
|
||||
|
||||
// Package mock_sqsclient is a generated GoMock package.
|
||||
package sqsclient
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
sqs "github.com/aws/aws-sdk-go-v2/service/sqs"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
)
|
||||
|
||||
// MockSQSClient is a mock of SQSClient interface.
|
||||
type MockSQSClient struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockSQSClientMockRecorder
|
||||
}
|
||||
|
||||
// MockSQSClientMockRecorder is the mock recorder for MockSQSClient.
|
||||
type MockSQSClientMockRecorder struct {
|
||||
mock *MockSQSClient
|
||||
}
|
||||
|
||||
// NewMockSQSClient creates a new mock instance.
|
||||
func NewMockSQSClient(ctrl *gomock.Controller) *MockSQSClient {
|
||||
mock := &MockSQSClient{ctrl: ctrl}
|
||||
mock.recorder = &MockSQSClientMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockSQSClient) EXPECT() *MockSQSClientMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// CreateQueue mocks base method.
|
||||
func (m *MockSQSClient) CreateQueue(ctx context.Context, input *sqs.CreateQueueInput, optFns ...func(*sqs.Options)) (*sqs.CreateQueueOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "CreateQueue", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.CreateQueueOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// CreateQueue indicates an expected call of CreateQueue.
|
||||
func (mr *MockSQSClientMockRecorder) CreateQueue(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateQueue", reflect.TypeOf((*MockSQSClient)(nil).CreateQueue), varargs...)
|
||||
}
|
||||
|
||||
// DeleteMessage mocks base method.
|
||||
func (m *MockSQSClient) DeleteMessage(ctx context.Context, input *sqs.DeleteMessageInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "DeleteMessage", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.DeleteMessageOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// DeleteMessage indicates an expected call of DeleteMessage.
|
||||
func (mr *MockSQSClientMockRecorder) DeleteMessage(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteMessage", reflect.TypeOf((*MockSQSClient)(nil).DeleteMessage), varargs...)
|
||||
}
|
||||
|
||||
// DeleteQueue mocks base method.
|
||||
func (m *MockSQSClient) DeleteQueue(ctx context.Context, input *sqs.DeleteQueueInput, optFns ...func(*sqs.Options)) (*sqs.DeleteQueueOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "DeleteQueue", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.DeleteQueueOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// DeleteQueue indicates an expected call of DeleteQueue.
|
||||
func (mr *MockSQSClientMockRecorder) DeleteQueue(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteQueue", reflect.TypeOf((*MockSQSClient)(nil).DeleteQueue), varargs...)
|
||||
}
|
||||
|
||||
// GetQueueAttributes mocks base method.
|
||||
func (m *MockSQSClient) GetQueueAttributes(ctx context.Context, input *sqs.GetQueueAttributesInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueAttributesOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "GetQueueAttributes", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.GetQueueAttributesOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetQueueAttributes indicates an expected call of GetQueueAttributes.
|
||||
func (mr *MockSQSClientMockRecorder) GetQueueAttributes(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueueAttributes", reflect.TypeOf((*MockSQSClient)(nil).GetQueueAttributes), varargs...)
|
||||
}
|
||||
|
||||
// GetQueueUrl mocks base method.
|
||||
func (m *MockSQSClient) GetQueueUrl(ctx context.Context, input *sqs.GetQueueUrlInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "GetQueueUrl", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.GetQueueUrlOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetQueueUrl indicates an expected call of GetQueueUrl.
|
||||
func (mr *MockSQSClientMockRecorder) GetQueueUrl(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetQueueUrl", reflect.TypeOf((*MockSQSClient)(nil).GetQueueUrl), varargs...)
|
||||
}
|
||||
|
||||
// ListQueues mocks base method.
|
||||
func (m *MockSQSClient) ListQueues(ctx context.Context, input *sqs.ListQueuesInput, optFns ...func(*sqs.Options)) (*sqs.ListQueuesOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "ListQueues", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.ListQueuesOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ListQueues indicates an expected call of ListQueues.
|
||||
func (mr *MockSQSClientMockRecorder) ListQueues(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListQueues", reflect.TypeOf((*MockSQSClient)(nil).ListQueues), varargs...)
|
||||
}
|
||||
|
||||
// ReceiveMessage mocks base method.
|
||||
func (m *MockSQSClient) ReceiveMessage(ctx context.Context, input *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "ReceiveMessage", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.ReceiveMessageOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// ReceiveMessage indicates an expected call of ReceiveMessage.
|
||||
func (mr *MockSQSClientMockRecorder) ReceiveMessage(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceiveMessage", reflect.TypeOf((*MockSQSClient)(nil).ReceiveMessage), varargs...)
|
||||
}
|
||||
|
||||
// SendMessage mocks base method.
|
||||
func (m *MockSQSClient) SendMessage(ctx context.Context, input *sqs.SendMessageInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []interface{}{ctx, input}
|
||||
for _, a := range optFns {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "SendMessage", varargs...)
|
||||
ret0, _ := ret[0].(*sqs.SendMessageOutput)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SendMessage indicates an expected call of SendMessage.
|
||||
func (mr *MockSQSClientMockRecorder) SendMessage(ctx, input interface{}, optFns ...interface{}) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]interface{}{ctx, input}, optFns...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockSQSClient)(nil).SendMessage), varargs...)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue