api

package
v0.0.0-...-c208585 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSeconds

func ParseSeconds(s string) (int64, int64, error)

ParseSeconds turns a string of fractional seconds into Seconds and Nanoseconds

func ParseUnixTime

func ParseUnixTime(seconds string) (time.Time, error)

ParseUnixTime turns a string of fractional seconds into time.Time

func Route

func Route(r chi.Router, runOpts *options.ServerConfig)

Route will set up the API and such

func RouteStopped

func RouteStopped(r chi.Router, runOpts *options.ServerConfig)

RouteStopped is for testing

func SecondsToInts

func SecondsToInts(seconds float64) (int64, int64)

SecondsToInts turns a float64 Second into Seconds and Nanoseconds

Types

type HTTPError

type HTTPError struct {
	Success bool   `json:"success"`
	Code    string `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	Detail  string `json:"detail,omitempty"`
}

HTTPError for http errors

func ParseSince

func ParseSince(sinceStr string) (time.Time, *HTTPError)

ParseSince will parse the query string into time.Time

type KillMsg

type KillMsg struct {
	JobID string `json:"job_id"`
	Kill  bool   `json:"kill"`
}

KillMsg describes which job to kill

type PyResult

type PyResult struct {
	Created  float64 `json:"created"`
	Duration float64 `json:"duration"`
	ExitCode int     `json:"exitcode"`
	Root     string  `json:"root"`
	/*
		Environment struct {
			Python   string `json:"Python"`
			Platform string `json:"Platform"`
			Packages struct {
				Pytest string `json:"pytest"`
				Py     string `json:"py"`
				Pluggy string `json:"pluggy"`
			} `json:"Packages"`
			Plugins struct {
				HTML       string `json:"html"`
				Metadata   string `json:"metadata"`
				JSONReport string `json:"json-report"`
			} `json:"Plugins"`
		} `json:"environment"`
		Summary struct {
			Passed    int `json:"passed"`
			Total     int `json:"total"`
			Collected int `json:"collected"`
		} `json:"summary"`
		Collectors []struct {
			Nodeid  string `json:"nodeid"`
			Outcome string `json:"outcome"`
			Result  []struct {
				Nodeid string `json:"nodeid"`
				Type   string `json:"type"`
			} `json:"result"`
		} `json:"collectors"`
	*/
	Tests []struct {
		NodeID   string   `json:"nodeid"`
		LineNo   int      `json:"lineno"`
		Outcome  string   `json:"outcome"`
		Keywords []string `json:"keywords"`
		Setup    struct {
			Duration float64 `json:"duration"`
			Outcome  string  `json:"outcome"`
		} `json:"setup"`
		Call struct {
			Duration float64 `json:"duration"`
			Outcome  string  `json:"outcome"`
		} `json:"call"`
		Teardown struct {
			Duration float64 `json:"duration"`
			Outcome  string  `json:"outcome"`
		} `json:"teardown"`
	} `json:"tests"`
}

PyResult is the pytest report

type Repo

type Repo struct {
	ID         string   `json:"id"`
	CloneURL   string   `json:"clone_url"`
	Promotions []string `json:"_promotions"`
}

Repo is one of the elements of /api/repos

type ReposResponse

type ReposResponse struct {
	Success bool   `json:"success"`
	Repos   []Repo `json:"repos"`
}

ReposResponse is the successful response to /api/repos

type WrappedReport

type WrappedReport struct {
	Report jobs.Result `json:"report"`
}

WrappedReport wraps results

func PyResultToReport

func PyResultToReport(pyresult PyResult) WrappedReport

PyResultToReport converts from pytest's result.json to the GitDeploy report format

Jump to

Keyboard shortcuts

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