api

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIHandler

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

func NewAPIHandler

func NewAPIHandler(logger logrus.FieldLogger, coordinator types.Coordinator) *APIHandler

func (*APIHandler) GetTest

func (ah *APIHandler) GetTest(w http.ResponseWriter, r *http.Request)

GetTest godoc @Id getTest @Summary Get test definition by test ID @Tags Test @Description Returns the test definition with given ID. @Produce json @Param testId path string true "ID of the test definition to get details for" @Success 200 {object} Response{data=GetTestResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test/{testId} [get]

func (*APIHandler) GetTestRun

func (ah *APIHandler) GetTestRun(w http.ResponseWriter, r *http.Request)

GetTestRun godoc @Id getTestRun @Summary Get test run by run ID @Tags TestRun @Description Returns the run details with given ID. Includes a summary and a list of task with limited details @Produce json @Param runId path string true "ID of the test run to get details for" @Success 200 {object} Response{data=GetTestRunResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test_run/{runId} [get]

func (*APIHandler) GetTestRunDetails

func (ah *APIHandler) GetTestRunDetails(w http.ResponseWriter, r *http.Request)

GetTestRunDetails godoc @Id getTestRunDetails @Summary Get detailed test run by run ID @Tags TestRun @Description Returns the run details with given ID. Includes a summary and a list of task with all details (incl. logs & task configurations) @Produce json @Param runId path string true "ID of the test run to get details for" @Success 200 {object} Response{data=GetTestRunDetailsResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test_run/{runId}/details [get]

func (*APIHandler) GetTestRunStatus

func (ah *APIHandler) GetTestRunStatus(w http.ResponseWriter, r *http.Request)

GetTestRunStatus godoc @Id getTestRunStatus @Summary Get test run status by run ID @Tags TestRun @Description Returns the run status with given ID. @Produce json @Param runId path string true "ID of the test run to get the status for" @Success 200 {object} Response{data=string} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test_run/{runId}/status [get]

func (*APIHandler) GetTestRuns

func (ah *APIHandler) GetTestRuns(w http.ResponseWriter, r *http.Request)

GetTestRuns godoc @Id getTestRuns @Summary Get list of test runs @Tags TestRun @Description Returns a list of all test runs. @Produce json @Param test_id query string false "Return test runs for this test ID only" @Success 200 {object} Response{data=[]GetTestRunsResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test_runs [get]

func (*APIHandler) GetTests

func (ah *APIHandler) GetTests(w http.ResponseWriter, r *http.Request)

GetTests godoc @Id getTests @Summary Get list of test definitions @Tags Test @Description Returns the list of test definitions. These test definitions can be used to create new test runs and are supplied via the assertoor configuration. @Produce json @Success 200 {object} Response{data=[]GetTestsResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/tests [get]

func (*APIHandler) PostTestRunCancel

func (ah *APIHandler) PostTestRunCancel(w http.ResponseWriter, r *http.Request)

PostTestRunCancel godoc @Id postTestRunCancel @Summary Cancel test run by test ID @Tags TestRun @Description Returns the test/run id & status of the cancelled test. @Produce json @Param runId path string true "ID of the test run to cancel" @Param cancelOptions body PostTestRunCancelRequest true "Test cancellation options" @Success 200 {object} Response{data=PostTestRunCancelResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test_run/{runId}/cancel [post]

func (*APIHandler) PostTestRunsSchedule added in v0.0.5

func (ah *APIHandler) PostTestRunsSchedule(w http.ResponseWriter, r *http.Request)

PostTestRunsSchedule godoc @Id postTestRunsSchedule @Summary Schedule new test run by test ID @Tags TestRun @Description Returns the test & run id of the scheduled test execution. @Produce json @Param runOptions body PostTestRunsScheduleRequest true "Rest run options" @Success 200 {object} Response{data=PostTestRunsScheduleResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/test_runs/schedule [post]

func (*APIHandler) PostTestsRegister added in v0.0.5

func (ah *APIHandler) PostTestsRegister(w http.ResponseWriter, r *http.Request)

PostTestsRegister godoc @Id postTestsRegister @Summary Register new test via yaml configuration @Tags Test @Description Returns the test id and name of the added test. @Produce json @Accept json,application/yaml @Param testConfig body PostTestsRegisterRequest true "Test configuration (json or yaml)" @Success 200 {object} Response{data=PostTestsRegisterResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/tests/register [post]

func (*APIHandler) PostTestsRegisterExternal added in v0.0.5

func (ah *APIHandler) PostTestsRegisterExternal(w http.ResponseWriter, r *http.Request)

PostTestsRegisterExternal godoc @Id postTestsRegisterExternal @Summary Register new test via external test configuration @Tags Test @Description Returns the test id and name of the added test. @Produce json @Accept json @Param externalTestConfig body PostTestsRegisterExternalRequest true "Test configuration (json or yaml)" @Success 200 {object} Response{data=PostTestsRegisterExternalResponse} "Success" @Failure 400 {object} Response "Failure" @Failure 500 {object} Response "Server Error" @Router /api/v1/tests/register_external [post]

type GetTestResponse

type GetTestResponse struct {
	ID         string              `json:"id"`
	Source     string              `json:"source"`
	Name       string              `json:"name"`
	Timeout    uint64              `json:"timeout"`
	Config     map[string]any      `json:"config"`
	ConfigVars map[string]string   `json:"configVars"`
	Schedule   *types.TestSchedule `json:"schedule"`
}

type GetTestRunDetailedTask

type GetTestRunDetailedTask struct {
	Index       uint64                       `json:"index"`
	ParentIndex uint64                       `json:"parent_index"`
	Name        string                       `json:"name"`
	Title       string                       `json:"title"`
	Started     bool                         `json:"started"`
	Completed   bool                         `json:"completed"`
	StartTime   int64                        `json:"start_time"`
	StopTime    int64                        `json:"stop_time"`
	Timeout     uint64                       `json:"timeout"`
	RunTime     uint64                       `json:"runtime"`
	Status      string                       `json:"status"`
	Result      string                       `json:"result"`
	ResultError string                       `json:"result_error"`
	Log         []*GetTestRunDetailedTaskLog `json:"log"`
	ConfigYaml  string                       `json:"config_yaml"`
	ResultYaml  string                       `json:"result_yaml"`
}

type GetTestRunDetailedTaskLog

type GetTestRunDetailedTaskLog struct {
	Time    time.Time         `json:"time"`
	Level   uint64            `json:"level"`
	Message string            `json:"msg"`
	DataLen uint64            `json:"datalen"`
	Data    map[string]string `json:"data"`
}

type GetTestRunDetailsResponse

type GetTestRunDetailsResponse struct {
	RunID     uint64                    `json:"run_id"`
	TestID    string                    `json:"test_id"`
	Name      string                    `json:"name"`
	Status    types.TestStatus          `json:"status"`
	StartTime int64                     `json:"start_time"`
	StopTime  int64                     `json:"stop_time"`
	Tasks     []*GetTestRunDetailedTask `json:"tasks"`
}

type GetTestRunResponse

type GetTestRunResponse struct {
	RunID     uint64            `json:"run_id"`
	TestID    string            `json:"test_id"`
	Name      string            `json:"name"`
	Status    types.TestStatus  `json:"status"`
	StartTime int64             `json:"start_time"`
	StopTime  int64             `json:"stop_time"`
	Tasks     []*GetTestRunTask `json:"tasks"`
}

type GetTestRunTask

type GetTestRunTask struct {
	Index       uint64 `json:"index"`
	ParentIndex uint64 `json:"parent_index"`
	Name        string `json:"name"`
	Title       string `json:"title"`
	Started     bool   `json:"started"`
	Completed   bool   `json:"completed"`
	StartTime   int64  `json:"start_time"`
	StopTime    int64  `json:"stop_time"`
	Timeout     uint64 `json:"timeout"`
	RunTime     uint64 `json:"runtime"`
	Status      string `json:"status"`
	Result      string `json:"result"`
	ResultError string `json:"result_error"`
}

type GetTestRunsResponse

type GetTestRunsResponse struct {
	RunID     uint64           `json:"run_id"`
	TestID    string           `json:"test_id"`
	Name      string           `json:"name"`
	Status    types.TestStatus `json:"status"`
	StartTime int64            `json:"start_time"`
	StopTime  int64            `json:"stop_time"`
}

type GetTestsResponse

type GetTestsResponse struct {
	ID     string `json:"id"`
	Source string `json:"source"`
	Name   string `json:"name"`
}

type PostTestRunCancelRequest

type PostTestRunCancelRequest struct {
	TestID      string `json:"test_id"`
	SkipCleanup bool   `json:"skip_cleanup"`
}

type PostTestRunCancelResponse

type PostTestRunCancelResponse struct {
	TestID string `json:"test_id"`
	RunID  uint64 `json:"run_id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

type PostTestRunsScheduleRequest added in v0.0.5

type PostTestRunsScheduleRequest struct {
	TestID         string         `json:"test_id"`
	Config         map[string]any `json:"config"`
	AllowDuplicate bool           `json:"allow_duplicate"`
}

type PostTestRunsScheduleResponse added in v0.0.5

type PostTestRunsScheduleResponse struct {
	TestID string         `json:"test_id"`
	RunID  uint64         `json:"run_id"`
	Name   string         `json:"name"`
	Config map[string]any `json:"config"`
}

type PostTestsRegisterExternalRequest added in v0.0.5

type PostTestsRegisterExternalRequest struct {
	File       string                 `yaml:"file" json:"file"`
	Name       string                 `yaml:"name" json:"name,omitempty"`
	Timeout    uint64                 `yaml:"timeout" json:"timeout,omitempty"`
	Config     map[string]interface{} `yaml:"config" json:"config,omitempty"`
	ConfigVars map[string]string      `yaml:"configVars" json:"configVars,omitempty"`
	Schedule   *types.TestSchedule    `yaml:"schedule" json:"schedule,omitempty"`
}

type PostTestsRegisterExternalResponse added in v0.0.5

type PostTestsRegisterExternalResponse struct {
	TestID string         `json:"test_id"`
	Name   string         `json:"name"`
	Config map[string]any `json:"config"`
}

type PostTestsRegisterRequest added in v0.0.5

type PostTestsRegisterRequest struct {
	ID           string                 `yaml:"id" json:"id"`
	Name         string                 `yaml:"name" json:"name"`
	Timeout      string                 `yaml:"timeout" json:"timeout"`
	Config       map[string]interface{} `yaml:"config" json:"config"`
	ConfigVars   map[string]string      `yaml:"configVars" json:"configVars"`
	Tasks        []helper.RawMessage    `yaml:"tasks" json:"tasks"`
	CleanupTasks []helper.RawMessage    `yaml:"cleanupTasks" json:"cleanupTasks"`
	Schedule     *types.TestSchedule    `yaml:"schedule" json:"schedule"`
}

type PostTestsRegisterResponse added in v0.0.5

type PostTestsRegisterResponse struct {
	TestID string         `json:"test_id"`
	Name   string         `json:"name"`
	Config map[string]any `json:"config"`
}

type Response

type Response struct {
	Status string      `json:"status"`
	Data   interface{} `json:"data"`
}

Directories

Path Synopsis
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.

Jump to

Keyboard shortcuts

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