Documentation ¶
Index ¶
- Variables
- func BeforeOnce(beforeBlock func())
- func CreateTestApp(db interfaces.DB, options ...map[string]interface{}) *model.App
- func CreateTestApps(db interfaces.DB, n int, options ...map[string]interface{}) []*model.App
- func CreateTestJob(db interfaces.DB, appID uuid.UUID, templateName string, ...) *model.Job
- func CreateTestJobs(db interfaces.DB, appID uuid.UUID, templateName string, n int, ...) []*model.Job
- func CreateTestTemplate(db interfaces.DB, appID uuid.UUID, options ...map[string]interface{}) *model.Template
- func CreateTestTemplates(db interfaces.DB, appID uuid.UUID, n int, options ...map[string]interface{}) []*model.Template
- func CreateTestUser(db interfaces.DB, options ...map[string]interface{}) *model.User
- func CreateTestUsers(db interfaces.DB, n int, options ...map[string]interface{}) []*model.User
- func Delete(app *api.Application, url, auth string) (int, string)
- func Get(app *api.Application, url, auth string) (int, string)
- func GetAppPayload(options ...map[string]interface{}) map[string]interface{}
- func GetConf() *viper.Viper
- func GetConfPath() string
- func GetDefaultTestApp(logger zap.Logger) *api.Application
- func GetFaultyTestDB(a *api.Application) *pg.DB
- func GetJobPayload(options ...map[string]interface{}) map[string]interface{}
- func GetTemplatePayload(options ...map[string]interface{}) map[string]interface{}
- func GetTemplatePayloads(amount int, options ...map[string]interface{}) []map[string]interface{}
- func GetTestDB(a *api.Application) *pg.DB
- func GetUserPayload(options ...map[string]interface{}) map[string]interface{}
- func MockStdout()
- func Post(app *api.Application, url, body string, auth string) (int, string)
- func Put(app *api.Application, url, body string, auth string) (int, string)
- func ReadLinesFromIOReader(reader io.Reader) []string
- func RedisReplyToBytes(reply interface{}, err error) ([]byte, error)
- type FakeKafkaProducer
- type FakeS3
- func (s *FakeS3) CompleteMultipartUpload(multipartUpload *s3.CreateMultipartUploadOutput, parts []*s3.CompletedPart) error
- func (s *FakeS3) DownloadChunk(start, size int64, path string) (int, *bytes.Buffer, error)
- func (s *FakeS3) GetObject(path string) ([]byte, error)
- func (s *FakeS3) InitMultipartUpload(path string) (*s3.CreateMultipartUploadOutput, error)
- func (s *FakeS3) PutObject(path string, body *[]byte) (*s3.PutObjectOutput, error)
- func (s *FakeS3) PutObjectRequest(path string) (string, error)
- func (s *FakeS3) UploadPart(input *bytes.Buffer, multipartUpload *s3.CreateMultipartUploadOutput, ...) (*s3.UploadPartOutput, error)
- type MyReaderCloser
- type PGMock
- func (m *PGMock) Begin() (*pg.Tx, error)
- func (m *PGMock) Close() error
- func (m *PGMock) Delete(params interface{}) error
- func (m *PGMock) Exec(obj interface{}, params ...interface{}) (*types.Result, error)
- func (m *PGMock) ExecOne(obj interface{}, params ...interface{}) (*types.Result, error)
- func (m *PGMock) Insert(params ...interface{}) error
- func (m *PGMock) Model(params ...interface{}) *orm.Query
- func (m *PGMock) Query(obj interface{}, query interface{}, params ...interface{}) (*types.Result, error)
- func (m *PGMock) QueryOne(obj interface{}, query interface{}, params ...interface{}) (*types.Result, error)
- func (m *PGMock) Select(params interface{}) error
- func (m *PGMock) Update(params interface{}) error
- type TestBuffer
Constants ¶
This section is empty.
Variables ¶
var ReadStdout func() string
ReadStdout value
var ResetStdout func()
ResetStdout back to os.Stdout
Functions ¶
func BeforeOnce ¶
func BeforeOnce(beforeBlock func())
BeforeOnce runs the before each block only once
func CreateTestApp ¶ added in v0.5.0
func CreateTestApp(db interfaces.DB, options ...map[string]interface{}) *model.App
CreateTestApp with specified optional values
func CreateTestApps ¶ added in v0.5.0
CreateTestApps for n apps
func CreateTestJob ¶ added in v0.5.0
func CreateTestJob(db interfaces.DB, appID uuid.UUID, templateName string, options ...map[string]interface{}) *model.Job
CreateTestJob with specified optional values
func CreateTestJobs ¶ added in v0.5.0
func CreateTestJobs(db interfaces.DB, appID uuid.UUID, templateName string, n int, options ...map[string]interface{}) []*model.Job
CreateTestJobs for n apps
func CreateTestTemplate ¶ added in v0.5.0
func CreateTestTemplate(db interfaces.DB, appID uuid.UUID, options ...map[string]interface{}) *model.Template
CreateTestTemplate with specified optional values
func CreateTestTemplates ¶ added in v0.5.0
func CreateTestTemplates(db interfaces.DB, appID uuid.UUID, n int, options ...map[string]interface{}) []*model.Template
CreateTestTemplates for n apps
func CreateTestUser ¶
func CreateTestUser(db interfaces.DB, options ...map[string]interface{}) *model.User
CreateTestUser with specified optional values
func CreateTestUsers ¶
CreateTestUsers for n users
func GetAppPayload ¶ added in v0.5.0
GetAppPayload with specified optional values
func GetDefaultTestApp ¶
func GetDefaultTestApp(logger zap.Logger) *api.Application
GetDefaultTestApp returns a new marathon API Application bound to 0.0.0.0:8833 for test
func GetFaultyTestDB ¶ added in v0.5.0
func GetFaultyTestDB(a *api.Application) *pg.DB
GetFaultyTestDB returns an ill-configured database for usage in tests
func GetJobPayload ¶ added in v0.5.0
GetJobPayload with specified optional values
func GetTemplatePayload ¶ added in v0.5.0
GetTemplatePayload with specified optional values
func GetTemplatePayloads ¶
GetTemplatePayloads with specified optional values
func GetUserPayload ¶
GetUserPayload with specified optional values
func ReadLinesFromIOReader ¶ added in v0.5.0
ReadLinesFromIOReader for testing
func RedisReplyToBytes ¶ added in v0.5.0
RedisReplyToBytes for testing
Types ¶
type FakeKafkaProducer ¶ added in v1.0.0
FakeKafkaProducer is a mock producer that implements PushProducer interface
func NewFakeKafkaProducer ¶ added in v1.0.0
func NewFakeKafkaProducer() *FakeKafkaProducer
NewFakeKafkaProducer creates a new FakeKafkaProducer
func (*FakeKafkaProducer) SendAPNSPush ¶ added in v1.0.0
func (f *FakeKafkaProducer) SendAPNSPush(topic, deviceToken string, payload, messageMetadata map[string]interface{}, pushMetadata map[string]interface{}, pushExpiry int64, templateName string) error
SendAPNSPush for testing
func (*FakeKafkaProducer) SendGCMPush ¶ added in v1.0.0
func (f *FakeKafkaProducer) SendGCMPush(topic, deviceToken string, payload, messageMetadata map[string]interface{}, pushMetadata map[string]interface{}, pushExpiry int64, templateName string) error
SendGCMPush for testing
type FakeS3 ¶ added in v0.5.0
type FakeS3 struct {
// contains filtered or unexported fields
}
FakeS3 for usage in tests
func (*FakeS3) CompleteMultipartUpload ¶
func (s *FakeS3) CompleteMultipartUpload(multipartUpload *s3.CreateMultipartUploadOutput, parts []*s3.CompletedPart) error
CompleteMultipartUpload mock the real CompleteMultipartUpload
func (*FakeS3) DownloadChunk ¶
DownloadChunk get part of the csv file
func (*FakeS3) InitMultipartUpload ¶
func (s *FakeS3) InitMultipartUpload(path string) (*s3.CreateMultipartUploadOutput, error)
InitMultipartUpload mock the real InitMultipartUpload
func (*FakeS3) PutObjectRequest ¶
PutObjectRequest mock the real PutObjectRequest
func (*FakeS3) UploadPart ¶
func (s *FakeS3) UploadPart(input *bytes.Buffer, multipartUpload *s3.CreateMultipartUploadOutput, partNumber int64) (*s3.UploadPartOutput, error)
UploadPart mock the real UploadPart function
type MyReaderCloser ¶ added in v0.5.0
MyReaderCloser for usage in tests
func (MyReaderCloser) Close ¶ added in v0.5.0
func (MyReaderCloser) Close() error
Close for usage in tests
type PGMock ¶ added in v1.0.0
type PGMock struct { Execs [][]interface{} ExecOnes [][]interface{} Queries [][]interface{} Closed bool RowsAffected int RowsReturned int Error error }
PGMock should be used for tests that need to connect to PG
func (*PGMock) Query ¶ added in v1.0.0
func (m *PGMock) Query(obj interface{}, query interface{}, params ...interface{}) (*types.Result, error)
Query stores executed params
func (*PGMock) QueryOne ¶
func (m *PGMock) QueryOne(obj interface{}, query interface{}, params ...interface{}) (*types.Result, error)
QueryOne stores executed params
type TestBuffer ¶
TestBuffer is a mock buffer