server

package
v0.0.0-...-f65c7fa Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Basename string
	// [begin, end], inclusive
	Begin, End int64
}

Change represents the change of some region in the file.

type Job

type Job struct {
	ID                               int64
	DirPath                          string
	Status                           JobStatus
	GoTestOptions                    []string
	CreatedAt, StartedAt, FinishedAt time.Time
	TaskSets                         []*TaskSet
	Tasks                            []*Task
	// contains filtered or unexported fields
}

Job represents the job to test one package.

func NewJob

func NewJob(dirPath string, bypass bool, changes []Change, goTestOpts []string, w io.Writer) (*Job, error)

NewJob returns the new job.

func (*Job) Run

func (j *Job) Run(ctx context.Context)

Run runs all the task sets in order (not in parallel).

type JobStatus

type JobStatus int

JobStatus represents the status of the job.

const (
	JobStatusCreated JobStatus = iota
	JobStatusSuccessful
	JobStatusFailed
)

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

Server serves the APIs for the cli client.

func NewServer

func NewServer(addr string) Server

NewServer returns a new server. We can use only one server instance in the process even if the address is different.

func (Server) Shutdown

func (s Server) Shutdown(ctx context.Context) error

Shutdown shutdowns the server.

type Task

type Task struct {
	TestFunction string
	Important    bool
}

Task represents one test function.

type TaskSet

type TaskSet struct {
	// this id must be the valid index of the Job.TaskSets.
	ID                    int
	Status                TaskSetStatus
	StartedAt, FinishedAt time.Time
	Tasks                 []*Task
	// contains filtered or unexported fields
}

TaskSet represents the set of tasks handled by one worker.

func NewTaskSet

func NewTaskSet(id int, job *Job) *TaskSet

NewTaskSet returns the new task set.

func (*TaskSet) Start

func (s *TaskSet) Start(ctx context.Context) error

Start starts the worker.

func (*TaskSet) Wait

func (s *TaskSet) Wait()

Wait waits the worker finished.

type TaskSetStatus

type TaskSetStatus int

TaskSetStatus represents the status of the task set.

const (
	TaskSetStatusCreated TaskSetStatus = iota
	TaskSetStatusStarted
	TaskSetStatusSuccessful
	TaskSetStatusFailed
)

Jump to

Keyboard shortcuts

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