tests

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RELATED_FORUM  = "forum"
	RELATED_USER   = "user"
	RELATED_THREAD = "thread"
)
View Source
const (
	SORT_FLAT   = "flat"
	SORT_TREE   = "tree"
	SORT_PARENT = "parent_tree"
)
View Source
const (
	KEY_STATUS = "expected-status"
	KEY_BODY   = "expected-body"
	KEY_FILTER = "expected-filter"
	KEY_SKIP   = "dont-check"

	MaxIdleConnections int = 20
)
View Source
const (
	WeightNever  PerfWeight = 0
	WeightRare              = 1
	WeightNormal            = 10
)
View Source
const (
	VERSION_UNKNOWN = iota
	VERSION_OUTDATE
	VERSION_LOCAL
	VERSION_LATEST
)
View Source
const ABC_NICK = "0123456789abcdefghijklmnopqrstuvwxyz"
View Source
const ABC_SLUG = "0123456789abcdefghijklmnopqrstuvwxyz_-"
View Source
const POST_FAKE_ID int64 = 2139800938
View Source
const POST_POWER = 16
View Source
const (
	SERIALIZE_VERSION int = 1
)
View Source
const THREAD_FAKE_ID = "2139800939"

Variables

View Source
var (
	Project   = "technopark-dbms-forum"
	Version   = "0.3.0"
	BuildTag  string
	GitCommit string
)
View Source
var HttpTransport *http.Transport

Functions

func CheckClear added in v0.1.0

func CheckClear(c *client.Forum, f *Factory)

func CheckForum

func CheckForum(c *client.Forum, forum *models.Forum)

func CheckForumCreateConflict

func CheckForumCreateConflict(c *client.Forum, f *Factory, m *Modify)

func CheckForumCreateSimple

func CheckForumCreateSimple(c *client.Forum, f *Factory)

func CheckForumCreateUnicode

func CheckForumCreateUnicode(c *client.Forum, f *Factory)

func CheckForumCreateUserCase

func CheckForumCreateUserCase(c *client.Forum, f *Factory, m *Modify)

func CheckForumCreateUserNotFound

func CheckForumCreateUserNotFound(c *client.Forum, f *Factory)

func CheckForumGetOneCounter added in v0.2.1

func CheckForumGetOneCounter(c *client.Forum, f *Factory)

func CheckForumGetOneNocase

func CheckForumGetOneNocase(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetOneNotFound

func CheckForumGetOneNotFound(c *client.Forum, f *Factory)

func CheckForumGetOneSimple

func CheckForumGetOneSimple(c *client.Forum, f *Factory)

func CheckForumGetThreadsNotFound added in v0.1.0

func CheckForumGetThreadsNotFound(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetThreadsSimple added in v0.1.0

func CheckForumGetThreadsSimple(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetUsersCollation added in v0.2.0

func CheckForumGetUsersCollation(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetUsersEmpty added in v0.1.0

func CheckForumGetUsersEmpty(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetUsersNotFound added in v0.1.0

func CheckForumGetUsersNotFound(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetUsersSimple added in v0.1.0

func CheckForumGetUsersSimple(c *client.Forum, f *Factory, m *Modify)

func CheckForumGetUsersVote added in v0.1.0

func CheckForumGetUsersVote(c *client.Forum, f *Factory, m *Modify)

func CheckIsType

func CheckIsType(expectedType interface{}, object interface{})

func CheckNil

func CheckNil(err interface{})

func CheckPost

func CheckPost(c *client.Forum, post *models.Post)

func CheckPostCreateDeepParent added in v0.1.0

func CheckPostCreateDeepParent(c *client.Forum, f *Factory)

func CheckPostCreateEmpty added in v0.1.0

func CheckPostCreateEmpty(c *client.Forum, f *Factory, m *Modify)

func CheckPostCreateInvalidParent added in v0.1.0

func CheckPostCreateInvalidParent(c *client.Forum, f *Factory, m *Modify)

func CheckPostCreateNoAuthor added in v0.1.0

func CheckPostCreateNoAuthor(c *client.Forum, f *Factory, m *Modify)

func CheckPostCreateNoThread added in v0.1.0

func CheckPostCreateNoThread(c *client.Forum, f *Factory, m *Modify)

func CheckPostCreateSameTime added in v0.2.1

func CheckPostCreateSameTime(c *client.Forum, f *Factory, m *Modify)

func CheckPostCreateSimple

func CheckPostCreateSimple(c *client.Forum, f *Factory, m *Modify)

func CheckPostCreateUnicode added in v0.1.0

func CheckPostCreateUnicode(c *client.Forum, f *Factory)

func CheckPostCreateWithParent added in v0.1.0

func CheckPostCreateWithParent(c *client.Forum, f *Factory)

func CheckPostGetOneNotFound added in v0.1.0

func CheckPostGetOneNotFound(c *client.Forum, f *Factory, m *Modify)

func CheckPostGetOneRelated added in v0.1.0

func CheckPostGetOneRelated(c *client.Forum, f *Factory, m *Modify)

func CheckPostGetOneSimple added in v0.1.0

func CheckPostGetOneSimple(c *client.Forum, f *Factory)

func CheckPostUpdateCase added in v0.1.0

func CheckPostUpdateCase(c *client.Forum, f *Factory)

func CheckPostUpdateEmpty added in v0.1.0

func CheckPostUpdateEmpty(c *client.Forum, f *Factory)

func CheckPostUpdateNotFound added in v0.1.0

func CheckPostUpdateNotFound(c *client.Forum, f *Factory)

func CheckPostUpdateSame added in v0.1.0

func CheckPostUpdateSame(c *client.Forum, f *Factory)

func CheckPostUpdateSimple added in v0.1.0

func CheckPostUpdateSimple(c *client.Forum, f *Factory)

func CheckStatus added in v0.1.0

func CheckStatus(c *client.Forum, f *Factory)

func CheckThread

func CheckThread(c *client.Forum, thread *models.Thread)

func CheckThreadCreateConflict added in v0.1.0

func CheckThreadCreateConflict(c *client.Forum, f *Factory, m *Modify)

func CheckThreadCreateNoAuthor added in v0.1.0

func CheckThreadCreateNoAuthor(c *client.Forum, f *Factory)

func CheckThreadCreateNoCase added in v0.1.0

func CheckThreadCreateNoCase(c *client.Forum, f *Factory, m *Modify)

func CheckThreadCreateNoForum added in v0.1.0

func CheckThreadCreateNoForum(c *client.Forum, f *Factory)

func CheckThreadCreateSimple

func CheckThreadCreateSimple(c *client.Forum, f *Factory, m *Modify)

func CheckThreadCreateUnicode added in v0.1.0

func CheckThreadCreateUnicode(c *client.Forum, f *Factory)

func CheckThreadGetOneNotFound added in v0.1.0

func CheckThreadGetOneNotFound(c *client.Forum, f *Factory)

func CheckThreadGetOneSimple added in v0.1.0

func CheckThreadGetOneSimple(c *client.Forum, f *Factory, m *Modify)

func CheckThreadGetPosts added in v0.2.1

func CheckThreadGetPosts(c *client.Forum, f *Factory, m *Modify, tree [][]int, limit int32)

func CheckThreadGetPostsNotFound added in v0.1.0

func CheckThreadGetPostsNotFound(c *client.Forum, f *Factory)

func CheckThreadGetPostsSameTime added in v0.2.1

func CheckThreadGetPostsSameTime(c *client.Forum, f *Factory, m *Modify)

func CheckThreadGetPostsSimple added in v0.1.0

func CheckThreadGetPostsSimple(c *client.Forum, f *Factory, m *Modify)

func CheckThreadUpdateEmpty added in v0.1.0

func CheckThreadUpdateEmpty(c *client.Forum, f *Factory)

func CheckThreadUpdateNotFound added in v0.1.0

func CheckThreadUpdateNotFound(c *client.Forum, f *Factory)

func CheckThreadUpdatePart added in v0.1.0

func CheckThreadUpdatePart(c *client.Forum, f *Factory, m *Modify)

func CheckThreadUpdateSimple added in v0.1.0

func CheckThreadUpdateSimple(c *client.Forum, f *Factory, m *Modify)

func CheckThreadVoteSimple added in v0.1.0

func CheckThreadVoteSimple(c *client.Forum, f *Factory)

func CheckThreadVoteThreadNotFound added in v0.1.0

func CheckThreadVoteThreadNotFound(c *client.Forum, f *Factory)

func CheckThreadVoteUserNotFound added in v0.1.0

func CheckThreadVoteUserNotFound(c *client.Forum, f *Factory)

func CheckUser

func CheckUser(c *client.Forum, user *models.User)

func CheckUserCreateConflict

func CheckUserCreateConflict(c *client.Forum, f *Factory, m *Modify)

func CheckUserCreateSimple

func CheckUserCreateSimple(c *client.Forum, f *Factory)

func CheckUserCreateUnicode

func CheckUserCreateUnicode(c *client.Forum, f *Factory)

func CheckUserGetOneNocase

func CheckUserGetOneNocase(c *client.Forum, f *Factory, m *Modify)

func CheckUserGetOneNotFound

func CheckUserGetOneNotFound(c *client.Forum, f *Factory)

func CheckUserGetOneSimple

func CheckUserGetOneSimple(c *client.Forum, f *Factory)

func CheckUserUpdateConflict

func CheckUserUpdateConflict(c *client.Forum, f *Factory, m *Modify)

func CheckUserUpdateEmpty

func CheckUserUpdateEmpty(c *client.Forum, f *Factory)

func CheckUserUpdateNotFound

func CheckUserUpdateNotFound(c *client.Forum, f *Factory)

func CheckUserUpdatePart

func CheckUserUpdatePart(c *client.Forum, f *Factory, m *Modify)

func CheckUserUpdateSimple

func CheckUserUpdateSimple(c *client.Forum, f *Factory)

func Checkpoint

func Checkpoint(c *client.Forum, message string) bool

func Colorize added in v0.2.0

func Colorize(color int, message string) string

func CreateTransport added in v0.2.0

func CreateTransport(url *url.URL) *http_transport.Runtime

func DeltaToHtml added in v0.2.0

func DeltaToHtml(delta []difflib.DiffRecord) string

func DeltaToText added in v0.2.0

func DeltaToText(delta []difflib.DiffRecord) string

func EasyJSONConsumer added in v0.2.1

func EasyJSONConsumer() runtime.Consumer

func Expected

func Expected(statusCode int, body interface{}, prepare Filter) context.Context

func ExpectedError added in v0.2.1

func ExpectedError(statusCode int, format string, a ...interface{}) context.Context

func FillPosts added in v0.2.1

func FillPosts(perf *Perf, parallel int, timeout time.Time, count int, batchSize int)

func FillThreads added in v0.2.1

func FillThreads(perf *Perf, parallel int, timeout time.Time, count int)

func FillUsers added in v0.2.0

func FillUsers(perf *Perf, parallel int, timeout time.Time, count int)

func GetBody

func GetBody(stream *io.ReadCloser) ([]byte, error)

func GetDelta

func GetDelta(data []byte, expected interface{}, prepare Filter) (*[]difflib.DiffRecord, error)

func GetDiff

func GetDiff(actual string, expected string) *[]difflib.DiffRecord

func GetRandomCase added in v0.2.1

func GetRandomCase(s string) string

func GetRandomDesc added in v0.2.1

func GetRandomDesc() *bool

func GetRandomLimit added in v0.2.1

func GetRandomLimit() int32

func GetRandomRelated added in v0.2.1

func GetRandomRelated() []string

func GetRandomSort added in v0.2.1

func GetRandomSort() string

func GetSlugOrId added in v0.2.1

func GetSlugOrId(slug string, id int64) string

func InvertCase added in v0.1.0

func InvertCase(str string) string

func Modifications added in v0.1.0

func Modifications(checker func(c *client.Forum, f *Factory, modify *Modify)) func(c *client.Forum, f *Factory)

func ObjectsAreEqual

func ObjectsAreEqual(expected, actual interface{}) bool

func PagePosts added in v0.2.1

func PagePosts(posts []OrderedPost, limitType func(OrderedPost) int, limit int) []models.Posts

func PerfForumGetOneNotFound added in v0.2.1

func PerfForumGetOneNotFound(p *Perf, f *Factory)

func PerfForumGetOneSuccess added in v0.2.1

func PerfForumGetOneSuccess(p *Perf, f *Factory)

func PerfForumGetThreadsNotFound added in v0.2.1

func PerfForumGetThreadsNotFound(p *Perf, f *Factory)

func PerfForumGetThreadsSuccess added in v0.2.1

func PerfForumGetThreadsSuccess(p *Perf, f *Factory)

func PerfForumGetUsersNotFound added in v0.2.1

func PerfForumGetUsersNotFound(p *Perf, f *Factory)

func PerfForumGetUsersSuccess added in v0.2.1

func PerfForumGetUsersSuccess(p *Perf, f *Factory)

func PerfPostGetOneNotFound added in v0.2.1

func PerfPostGetOneNotFound(p *Perf, f *Factory)

func PerfPostGetOneSuccess added in v0.2.1

func PerfPostGetOneSuccess(p *Perf, f *Factory)

func PerfRegister added in v0.2.1

func PerfRegister(test PerfTest)

func PerfStatus added in v0.2.1

func PerfStatus(p *Perf, f *Factory)

func PerfThreadGetOneNotFound added in v0.2.1

func PerfThreadGetOneNotFound(p *Perf, f *Factory)

func PerfThreadGetOneSuccess added in v0.2.1

func PerfThreadGetOneSuccess(p *Perf, f *Factory)

func PerfThreadGetPostsNotFound added in v0.2.1

func PerfThreadGetPostsNotFound(p *Perf, f *Factory)

func PerfThreadGetPostsSuccess added in v0.2.1

func PerfThreadGetPostsSuccess(p *Perf, f *Factory)

func PerfUserGetOneNotFound added in v0.2.1

func PerfUserGetOneNotFound(p *Perf, f *Factory)

func PerfUserGetOneSuccess added in v0.2.1

func PerfUserGetOneSuccess(p *Perf, f *Factory)

func PrettyJson added in v0.2.0

func PrettyJson(body string) string

func RandomTime added in v0.1.0

func RandomTime() time.Time

func Register

func Register(checker Checker)

func Run

func Run(url *url.URL, mask *regexp.Regexp, report_file string, keep bool) int

func RunCheck

func RunCheck(check Checker, report *Report, url *url.URL)

func ToJsonPretty added in v0.2.1

func ToJsonPretty(obj interface{}) string

func VersionCheck added in v0.2.1

func VersionCheck() (int, error)

func VersionFull added in v0.2.1

func VersionFull() string

func VoteThreads added in v0.2.1

func VoteThreads(perf *Perf, parallel int, timeout time.Time, count int)

Types

type Abc added in v0.2.0

type Abc struct {
	// contains filtered or unexported fields
}

Алфавит

func NewAbc added in v0.2.0

func NewAbc(alphabet string) Abc

NewAbc constructs a new instance of shuffled alphabet to be used for Id representation.

func (*Abc) Encode added in v0.2.0

func (abc *Abc) Encode(rnd *rand.Rand, val, bits uint) []rune

Encode encodes a given value into a slice of runes of length nsymbols. In case nsymbols==0, the length of the result is automatically computed from data. Even if fewer symbols is required to encode the data than nsymbols, all positions are used encoding 0 where required to guarantee uniqueness in case further data is added to the sequence. The value of digits [4,6] represents represents n in 2^n, which defines how much randomness flows into the algorithm: 4 -- every value can be represented by 4 symbols in the alphabet (permitting at most 16 values), 5 -- every value can be represented by 2 symbols in the alphabet (permitting at most 32 values), 6 -- every value is represented by exactly 1 symbol with no randomness (permitting 64 values).

type Checker

type Checker struct {
	// Имя текущей проверки.
	Name string
	// Описание текущей проверки.
	Description string
	// Функция для текущей проверки.
	FnCheck func(c *client.Forum, f *Factory)
	// Тесты, без которых проверка не имеет смысл.
	Deps []string
}

func SortedChecks added in v0.2.0

func SortedChecks() []Checker

type CheckerByName added in v0.2.0

type CheckerByName []Checker

func (CheckerByName) Len added in v0.2.0

func (a CheckerByName) Len() int

func (CheckerByName) Less added in v0.2.0

func (a CheckerByName) Less(i, j int) bool

func (CheckerByName) Swap added in v0.2.0

func (a CheckerByName) Swap(i, j int)

type CheckerClientResponseReader added in v0.2.1

type CheckerClientResponseReader struct {
	// contains filtered or unexported fields
}

func (CheckerClientResponseReader) Consume added in v0.2.1

func (self CheckerClientResponseReader) Consume(r io.Reader, t interface{}) error

func (CheckerClientResponseReader) ReadResponse added in v0.2.1

func (self CheckerClientResponseReader) ReadResponse(response runtime.ClientResponse, _ runtime.Consumer) (interface{}, error)

type CheckerTransport

type CheckerTransport struct {
	// contains filtered or unexported fields
}

func (*CheckerTransport) Submit

func (self *CheckerTransport) Submit(operation *runtime.ClientOperation) (interface{}, error)

type Factory added in v0.2.1

type Factory struct {
	// contains filtered or unexported fields
}

func NewFactory added in v0.2.1

func NewFactory() *Factory

func (*Factory) CreateForum added in v0.2.1

func (f *Factory) CreateForum(c *client.Forum, forum *models.Forum, owner *models.User) *models.Forum

func (*Factory) CreatePost added in v0.2.1

func (f *Factory) CreatePost(c *client.Forum, post *models.Post, thread *models.Thread) *models.Post

func (*Factory) CreatePosts added in v0.2.1

func (f *Factory) CreatePosts(c *client.Forum, posts models.Posts, thread *models.Thread) models.Posts

func (*Factory) CreateThread added in v0.2.1

func (f *Factory) CreateThread(c *client.Forum, thread *models.Thread, forum *models.Forum, author *models.User) *models.Thread

func (*Factory) CreateTree added in v0.2.1

func (f *Factory) CreateTree(c *client.Forum, thread *models.Thread, tree [][]int) []OrderedPost

func (*Factory) CreateUser added in v0.2.1

func (f *Factory) CreateUser(c *client.Forum, user *models.User) *models.User

func (*Factory) RandomEmail added in v0.2.1

func (self *Factory) RandomEmail() strfmt.Email

func (*Factory) RandomForum added in v0.2.1

func (self *Factory) RandomForum() *models.Forum

func (*Factory) RandomNickname added in v0.2.1

func (self *Factory) RandomNickname() string

func (*Factory) RandomPost added in v0.2.1

func (self *Factory) RandomPost() *models.Post

func (*Factory) RandomPosts added in v0.2.1

func (self *Factory) RandomPosts(count int) []*models.Post

func (*Factory) RandomSlug added in v0.2.1

func (self *Factory) RandomSlug() string

func (*Factory) RandomThread added in v0.2.1

func (self *Factory) RandomThread() *models.Thread

func (*Factory) RandomUser added in v0.2.1

func (self *Factory) RandomUser() *models.User

type Filter

type Filter func(interface{}) interface{}

type Modify added in v0.1.0

type Modify int

func (*Modify) Bool added in v0.1.0

func (self *Modify) Bool() bool

func (*Modify) Case added in v0.1.0

func (self *Modify) Case(source string) string

func (*Modify) Int added in v0.1.0

func (self *Modify) Int(n int) int

func (*Modify) NullableBool added in v0.1.0

func (self *Modify) NullableBool() *bool

func (*Modify) SlugOrId added in v0.1.0

func (self *Modify) SlugOrId(thread *models.Thread) string

type OrderedPost added in v0.1.0

type OrderedPost struct {
	// contains filtered or unexported fields
}

type PForum added in v0.2.1

type PForum struct {
	Version   PVersion
	Posts     int64
	Slug      string
	Threads   int32
	TitleHash PHash
	User      *PUser
}

func (*PForum) Validate added in v0.2.1

func (self *PForum) Validate(v PerfValidator, forum *models.Forum, version PVersion)

type PHash added in v0.2.1

type PHash uint32

func Hash added in v0.2.1

func Hash(data string) PHash

func (*PHash) DecodeMsg added in v0.2.1

func (z *PHash) DecodeMsg(dc *msgp.Reader) (err error)

func (PHash) EncodeMsg added in v0.2.1

func (z PHash) EncodeMsg(en *msgp.Writer) (err error)

type PPost added in v0.2.1

type PPost struct {
	Version     PVersion
	ID          int64
	Author      *PUser
	Thread      *PThread
	Parent      *PPost
	Created     strfmt.DateTime
	IsEdited    bool
	MessageHash PHash
	Index       int32
	Path        []int32
}

func (*PPost) GetParentId added in v0.2.1

func (self *PPost) GetParentId() int64

func (*PPost) Validate added in v0.2.1

func (self *PPost) Validate(v PerfValidator, post *models.Post, version PVersion, prefix string)

type PPostSortFlat added in v0.2.1

type PPostSortFlat []*PPost

func (PPostSortFlat) Len added in v0.2.1

func (a PPostSortFlat) Len() int

func (PPostSortFlat) Less added in v0.2.1

func (a PPostSortFlat) Less(i, j int) bool

func (PPostSortFlat) Swap added in v0.2.1

func (a PPostSortFlat) Swap(i, j int)

type PPostSortParentDesc added in v0.2.1

type PPostSortParentDesc []*PPost

func (PPostSortParentDesc) Len added in v0.2.1

func (a PPostSortParentDesc) Len() int

func (PPostSortParentDesc) Less added in v0.2.1

func (a PPostSortParentDesc) Less(i, j int) bool

func (PPostSortParentDesc) Swap added in v0.2.1

func (a PPostSortParentDesc) Swap(i, j int)

type PPostSortTree added in v0.2.1

type PPostSortTree []*PPost

func (PPostSortTree) Len added in v0.2.1

func (a PPostSortTree) Len() int

func (PPostSortTree) Less added in v0.2.1

func (a PPostSortTree) Less(i, j int) bool

func (PPostSortTree) Swap added in v0.2.1

func (a PPostSortTree) Swap(i, j int)

type PStatus added in v0.2.1

type PStatus struct {
	Version PVersion
	Forum   int32
	Post    int64
	Thread  int32
	User    int32
}

type PThread added in v0.2.1

type PThread struct {
	Version     PVersion
	ID          int32
	Slug        string
	Author      *PUser
	Forum       *PForum
	MessageHash PHash
	TitleHash   PHash
	Created     strfmt.DateTime
	Voices      map[*PUser]int32
	Votes       int32
	Posts       int32
	// contains filtered or unexported fields
}

func (*PThread) Validate added in v0.2.1

func (self *PThread) Validate(v PerfValidator, thread *models.Thread, version PVersion)

type PThreadByCreated added in v0.2.1

type PThreadByCreated []*PThread

func (PThreadByCreated) Len added in v0.2.1

func (a PThreadByCreated) Len() int

func (PThreadByCreated) Less added in v0.2.1

func (a PThreadByCreated) Less(i, j int) bool

func (PThreadByCreated) Swap added in v0.2.1

func (a PThreadByCreated) Swap(i, j int)

type PUser added in v0.2.1

type PUser struct {
	Version      PVersion
	AboutHash    PHash
	Email        strfmt.Email
	FullnameHash PHash
	Nickname     string
}

func (*PUser) Validate added in v0.2.1

func (self *PUser) Validate(v PerfValidator, user *models.User, version PVersion)

type PUserByNickname added in v0.2.1

type PUserByNickname []*PUser

func (PUserByNickname) Len added in v0.2.1

func (a PUserByNickname) Len() int

func (PUserByNickname) Less added in v0.2.1

func (a PUserByNickname) Less(i, j int) bool

func (PUserByNickname) Swap added in v0.2.1

func (a PUserByNickname) Swap(i, j int)

type PVersion added in v0.2.1

type PVersion uint32

type Perf added in v0.2.1

type Perf struct {
	// contains filtered or unexported fields
}

func NewPerf added in v0.2.1

func NewPerf(url *url.URL, config *PerfConfig) *Perf

func (*Perf) Fill added in v0.2.1

func (self *Perf) Fill(threads int, timeout_sec int, config *PerfConfig)

func (*Perf) Load added in v0.2.1

func (self *Perf) Load(reader io.Reader) error

func (*Perf) Run added in v0.2.1

func (self *Perf) Run(threads int, duration int, step int) float64

func (*Perf) Save added in v0.2.1

func (self *Perf) Save(writer io.Writer) error

func (*Perf) Session added in v0.2.1

func (self *Perf) Session() *PerfSession

type PerfConfig added in v0.2.1

type PerfConfig struct {
	UserCount   int
	ForumCount  int
	ThreadCount int
	PostCount   int
	PostBatch   int
	VoteCount   int

	Validate float32
}

func NewPerfConfig added in v0.2.1

func NewPerfConfig() *PerfConfig

type PerfData added in v0.2.1

type PerfData struct {
	Status *PStatus
	// contains filtered or unexported fields
}

func LoadPerfData added in v0.2.1

func LoadPerfData(reader io.Reader) (*PerfData, error)

func NewPerfData added in v0.2.1

func NewPerfData(config *PerfConfig) *PerfData

func (*PerfData) AddForum added in v0.2.1

func (self *PerfData) AddForum(forum *PForum)

func (*PerfData) AddPost added in v0.2.1

func (self *PerfData) AddPost(post *PPost)

func (*PerfData) AddThread added in v0.2.1

func (self *PerfData) AddThread(thread *PThread)

func (*PerfData) AddUser added in v0.2.1

func (self *PerfData) AddUser(user *PUser)

func (*PerfData) GetForum added in v0.2.1

func (self *PerfData) GetForum(index int) *PForum

func (*PerfData) GetForumBySlug added in v0.2.1

func (self *PerfData) GetForumBySlug(slug string) *PForum

func (*PerfData) GetForumThreads added in v0.2.1

func (self *PerfData) GetForumThreads(forum *PForum) []*PThread

func (*PerfData) GetForumThreadsByCreated added in v0.2.1

func (self *PerfData) GetForumThreadsByCreated(forum *PForum, since *strfmt.DateTime, desc bool, limit int) []*PThread

func (*PerfData) GetForumUsers added in v0.2.1

func (self *PerfData) GetForumUsers(forum *PForum) []*PUser

func (*PerfData) GetForumUsersByNickname added in v0.2.1

func (self *PerfData) GetForumUsersByNickname(forum *PForum, since *string, desc bool, limit int) []*PUser

func (*PerfData) GetPost added in v0.2.1

func (self *PerfData) GetPost(index int, p float64) *PPost

func (*PerfData) GetPostById added in v0.2.1

func (self *PerfData) GetPostById(id int64) *PPost

func (*PerfData) GetThread added in v0.2.1

func (self *PerfData) GetThread(index int, p float64, offset float64) *PThread

func (*PerfData) GetThreadById added in v0.2.1

func (self *PerfData) GetThreadById(id int32) *PThread

func (*PerfData) GetThreadPostsFlat added in v0.2.1

func (self *PerfData) GetThreadPostsFlat(thread *PThread) []*PPost

func (*PerfData) GetThreadPostsParentDesc added in v0.2.1

func (self *PerfData) GetThreadPostsParentDesc(thread *PThread) []*PPost

func (*PerfData) GetThreadPostsTree added in v0.2.1

func (self *PerfData) GetThreadPostsTree(thread *PThread) []*PPost

func (*PerfData) GetUser added in v0.2.1

func (self *PerfData) GetUser(index int) *PUser

func (*PerfData) GetUserByNickname added in v0.2.1

func (self *PerfData) GetUserByNickname(nickname string) *PUser

func (*PerfData) Normalize added in v0.2.1

func (self *PerfData) Normalize()

func (*PerfData) Save added in v0.2.1

func (self *PerfData) Save(writer io.Writer) error

type PerfMode added in v0.2.1

type PerfMode int
const (
	ModeRead PerfMode = iota
	ModeWrite
)

type PerfSession added in v0.2.1

type PerfSession struct {
	// contains filtered or unexported fields
}

func (*PerfSession) CheckBool added in v0.2.1

func (self *PerfSession) CheckBool(expected bool, actual bool, message string)

func (*PerfSession) CheckDate added in v0.2.1

func (self *PerfSession) CheckDate(expected *strfmt.DateTime, actual *strfmt.DateTime, message string)

func (*PerfSession) CheckHash added in v0.2.1

func (self *PerfSession) CheckHash(expected PHash, actual string, message string)

func (*PerfSession) CheckInt added in v0.2.1

func (self *PerfSession) CheckInt(expected int, actual int, message string)

func (*PerfSession) CheckInt32 added in v0.2.1

func (self *PerfSession) CheckInt32(expected int32, actual int32, message string)

func (*PerfSession) CheckInt64 added in v0.2.1

func (self *PerfSession) CheckInt64(expected int64, actual int64, message string)

func (*PerfSession) CheckStr added in v0.2.1

func (self *PerfSession) CheckStr(expected string, actual string, message string)

func (*PerfSession) CheckVersion added in v0.2.1

func (self *PerfSession) CheckVersion(before PVersion, after PVersion) bool

func (*PerfSession) Expected added in v0.2.1

func (self *PerfSession) Expected(statusCode int) context.Context

func (*PerfSession) Finish added in v0.2.1

func (self *PerfSession) Finish(before PVersion, after PVersion)

func (*PerfSession) Validate added in v0.2.1

func (self *PerfSession) Validate(callback func(validator PerfValidator))

type PerfTest added in v0.2.1

type PerfTest struct {
	Name   string
	Mode   PerfMode
	Weight PerfWeight
	FnPerf func(p *Perf, f *Factory)
}

func GetRandomPerfTest added in v0.2.1

func GetRandomPerfTest() *PerfTest

type PerfValidator added in v0.2.1

type PerfValidator interface {
	CheckVersion(before PVersion, after PVersion) bool
	CheckInt(expected int, actual int, message string)
	CheckInt32(expected int32, actual int32, message string)
	CheckInt64(expected int64, actual int64, message string)
	CheckStr(expected string, actual string, message string)
	CheckBool(expected bool, actual bool, message string)
	CheckHash(expected PHash, actual string, message string)
	CheckDate(expected *strfmt.DateTime, actual *strfmt.DateTime, message string)
	Finish(before PVersion, after PVersion)
}

type PerfWeight added in v0.2.1

type PerfWeight int

type PostSortFlat added in v0.2.1

type PostSortFlat struct {
	// contains filtered or unexported fields
}

func (PostSortFlat) Len added in v0.2.1

func (a PostSortFlat) Len() int

func (PostSortFlat) Less added in v0.2.1

func (a PostSortFlat) Less(i, j int) bool

func (PostSortFlat) Swap added in v0.2.1

func (a PostSortFlat) Swap(i, j int)

type PostSortTree added in v0.1.0

type PostSortTree struct {
	// contains filtered or unexported fields
}

func (PostSortTree) Len added in v0.1.0

func (a PostSortTree) Len() int

func (PostSortTree) Less added in v0.1.0

func (a PostSortTree) Less(i, j int) bool

func (PostSortTree) Swap added in v0.1.0

func (a PostSortTree) Swap(i, j int)

type Report

type Report struct {
	Checker   Checker
	OnlyError bool
	Pass      []ReportPass
	SkippedBy []string
	Result    ResultType
}

func (*Report) AddError

func (self *Report) AddError(err interface{})

func (*Report) Checkpoint

func (self *Report) Checkpoint(message string) bool

func (*Report) RoundTrip

func (self *Report) RoundTrip(req *http.Request, res *http.Response, example *http.Response, delta *[]difflib.DiffRecord, err error)

func (*Report) Skip added in v0.2.0

func (self *Report) Skip(message string)

type ReportHttp added in v0.2.0

type ReportHttp struct {
	Title    string
	Header   http.Header
	BodyRaw  string
	BodyJson string
}

func RequestInfo added in v0.2.0

func RequestInfo(req *http.Request) *ReportHttp

func ResponseInfo added in v0.2.0

func ResponseInfo(res *http.Response) *ReportHttp

func (*ReportHttp) String added in v0.2.0

func (self *ReportHttp) String() string

type ReportMessage added in v0.2.0

type ReportMessage struct {
	Failed   bool
	Url      string
	Delta    template.HTML
	Request  *ReportHttp
	Response *ReportHttp
	Example  *ReportHttp
	Error    string
}

type ReportPass added in v0.2.0

type ReportPass struct {
	Name     string
	Failure  string
	Messages []ReportMessage
}

type ResultType added in v0.2.0

type ResultType int
const (
	Failed ResultType = iota
	Skipped
	Success
)

type Shortid added in v0.2.0

type Shortid struct {
	// contains filtered or unexported fields
}

Идентификатор

func NewShortid added in v0.2.0

func NewShortid(alphabet string) *Shortid

Создание нового генератора

func (*Shortid) Abc added in v0.2.0

func (sid *Shortid) Abc() Abc

Abc returns the instance of alphabet used for representing the Ids.

func (*Shortid) Epoch added in v0.2.0

func (sid *Shortid) Epoch() time.Time

Epoch returns the value of epoch used as the beginning of millisecond counting (normally 2016-01-01 00:00:00 local time)

func (*Shortid) Generate added in v0.2.0

func (sid *Shortid) Generate() string

func (*Shortid) GenerateRandom added in v0.2.0

func (sid *Shortid) GenerateRandom() []rune

Generate generates a new short Id.

type ThreadByCreated added in v0.1.0

type ThreadByCreated models.Threads

func (ThreadByCreated) Len added in v0.1.0

func (a ThreadByCreated) Len() int

func (ThreadByCreated) Less added in v0.1.0

func (a ThreadByCreated) Less(i, j int) bool

func (ThreadByCreated) Swap added in v0.1.0

func (a ThreadByCreated) Swap(i, j int)

type UserByNickname

type UserByNickname models.Users

func (UserByNickname) Len

func (a UserByNickname) Len() int

func (UserByNickname) Less

func (a UserByNickname) Less(i, j int) bool

func (UserByNickname) Swap

func (a UserByNickname) Swap(i, j int)

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

func NewValidator

func NewValidator(ctx context.Context, report *Report) *Validator

func (*Validator) Example

func (self *Validator) Example(req *http.Request) *http.Response

func (*Validator) RoundTrip

func (self *Validator) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL