scenario

package
v0.0.0-...-9b43f02 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBenchmarkerReceive failure.StringCode = "benchmarker-receive"
	ErrBenchmarkerReport  failure.StringCode = "benchmarker-report"
	ErrBenchmarkerPanic   failure.StringCode = "benchmarker-panic"
)
View Source
var (
	ContestantLogger *log.Logger
	AdminLogger      *log.Logger
)
View Source
var (
	ErrX400 failure.StringCode = "XSUPORTAL[400]"
	ErrX401 failure.StringCode = "XSUPORTAL[401]"
	ErrX402 failure.StringCode = "XSUPORTAL[402]"
	ErrX403 failure.StringCode = "XSUPORTAL[403]"
	ErrX404 failure.StringCode = "XSUPORTAL[404]"
	ErrX503 failure.StringCode = "XSUPORTAL[503]"

	ErrX5XX     failure.StringCode = "http-server-error"
	ErrProtobuf failure.StringCode = "protobuf-decode"
)
View Source
var (
	ErrScenarioCretical failure.StringCode = "scenario-critical"
	ErrScenarioCancel   failure.StringCode = "scenario-cancel"
)
View Source
var (
	ErrCritical        failure.StringCode = "critical"
	ErrInvalidResponse failure.StringCode = "invalid-response"
	ErrChecksum        failure.StringCode = "checksum"
	ErrWebPush         failure.StringCode = "webpush"
	ErrHTTP            failure.StringCode = "http"
)
View Source
var ErrBenchamrkJobDetail failure.StringCode = "get-benchmark-job"
View Source
var ErrLoadAdminGetClarification failure.StringCode = "admin-get-clarification"
View Source
var ErrLoadAdminListClarifications failure.StringCode = "admin-list-clarifications"
View Source
var ErrWebPushSubscription failure.StringCode = "webpush-subscription"

Functions

func AdminGetClarificationAction

func AdminGetClarificationAction(ctx context.Context, id int64, member *model.Contestant) (*admin.GetClarificationResponse, error)

func AdminGetClarificationsAction

func AdminGetClarificationsAction(ctx context.Context, member *model.Contestant) (*admin.ListClarificationsResponse, error)

func AssertEqual

func AssertEqual(msg string, expected interface{}, actual interface{}) bool

func AudienceGetDashboardAction

func AudienceGetDashboardAction(parent context.Context, agent *agent.Agent, timeout time.Duration) (*http.Response, *audience.DashboardResponse, error)

func BrowserAccessGuest

func BrowserAccessGuest(ctx context.Context, agent *agent.Agent, rpath string) (*http.Response, agent.Resources, error)

func EnqueueBenchmarkJobAction

func EnqueueBenchmarkJobAction(ctx context.Context, team *model.Team) (*contestant.EnqueueBenchmarkJobResponse, error)

func GetBenchmarkJobAction

func GetBenchmarkJobAction(ctx context.Context, id int64, member *model.Contestant) (*contestant.GetBenchmarkJobResponse, error)

func GetBenchmarkJobs

func GetBenchmarkJobs(ctx context.Context, team *model.Team, member *model.Contestant) (*contestant.ListBenchmarkJobsResponse, error)

func GetCurrentSession

func GetCurrentSession(ctx context.Context, member *model.Contestant) (*common.GetCurrentSessionResponse, error)

func GetDashboardAction

func GetDashboardAction(parent context.Context, team *model.Team, member *model.Contestant, timeout time.Duration) (*http.Response, *contestant.DashboardResponse, error)

func InitializeAction

func InitializeAction(ctx context.Context, a *agent.Agent, contest *model.Contest) (*admin.InitializeResponse, *http.Response, error)

func JoinTeamAction

func JoinTeamAction(ctx context.Context, team *model.Team, c *model.Contestant, inviteToken string) (*registration.JoinTeamResponse, error)

func ProtobufRequest

func ProtobufRequest(ctx context.Context, agent *agent.Agent, method string, rpath string, req proto.Message, res proto.Message, allowedStatuCodes []int) (*http.Response, error)

Types

type Benchmarker

type Benchmarker struct {
	Scenario *Scenario
	GRPCHost string
	GRPCPort int64
	UseTLS   bool
	TeamID   int64
}

func (*Benchmarker) Process

func (b *Benchmarker) Process(ctx context.Context, step *isucandar.BenchmarkStep) error

type ProtobufError

type ProtobufError struct {
	XError *xsuportal.Error
	Method string
	Path   string
}

func (*ProtobufError) Error

func (p *ProtobufError) Error() string

func (*ProtobufError) ErrorCode

func (p *ProtobufError) ErrorCode() string

type Scenario

type Scenario struct {
	BaseURL      string
	UseTLS       bool
	PushService  *pushserver.Service
	Language     string
	Contest      *model.Contest
	TeamCapacity int32
	NoLoad       bool
	NoClar       bool
	// contains filtered or unexported fields
}

func NewScenario

func NewScenario() (*Scenario, error)

func (*Scenario) AddAudience

func (s *Scenario) AddAudience(count int)

func (*Scenario) AddBenchmarker

func (s *Scenario) AddBenchmarker(teamID int64)

func (*Scenario) LatestMarkedAt

func (s *Scenario) LatestMarkedAt() time.Time

func (*Scenario) Load

func (s *Scenario) Load(parent context.Context, step *isucandar.BenchmarkStep) error

func (*Scenario) Mark

func (s *Scenario) Mark(t time.Time)

func (*Scenario) NewAgent

func (s *Scenario) NewAgent(opts ...agent.AgentOption) (*agent.Agent, error)

func (*Scenario) NewBenchmarker

func (s *Scenario) NewBenchmarker(id int64) *Benchmarker

func (*Scenario) Prepare

func (s *Scenario) Prepare(ctx context.Context, step *isucandar.BenchmarkStep) error

func (*Scenario) Validation

func (s *Scenario) Validation(ctx context.Context, step *isucandar.BenchmarkStep) error

Jump to

Keyboard shortcuts

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