gorp

package
v0.0.0-...-65b6697 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LaunchModeDefault = "DEFAULT"
	LaunchModeDebug   = "DEBUG"
	MergeTypeBasic    = "BASIC"
	MergeTypeDeep     = "DEEP"

	StatusStopped = "STOPPED"
	StatusPassed  = "PASSED"
	StatusFailed  = "FAILED"
)

Client constants

Variables

This section is empty.

Functions

func ConvertToFilterParams

func ConvertToFilterParams(filter *FilterResource) map[string]string

ConvertToFilterParams converts RP internal filter representation to query string

Types

type Attribute

type Attribute struct {
	Key    string `json:"key,omitempty"`
	Value  string `json:"value,omitempty"`
	System bool   `json:"system,omitempty"`
}

type Client

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

Client is ReportPortal REST API Client

func NewClient

func NewClient(host, project, uuid string) *Client

NewClient creates new instance of Client host - server hostname project - name of the project uuid - User Token (see user profile page)

func (*Client) FinishLaunch

func (c *Client) FinishLaunch(id string, launch *FinishExecutionRQ) (*FinishLaunchRS, error)

FinishLaunch finishes launch in RP

func (*Client) FinishLaunchRaw

func (c *Client) FinishLaunchRaw(id string, body *bytes.Buffer) (*FinishLaunchRS, error)

FinishLaunchRaw finishes launch in RP with body in form of bytes buffer

func (*Client) FinishTest

func (c *Client) FinishTest(id string, launch *FinishTestRQ) (*MsgRS, error)

FinishTest finishes test in RP

func (*Client) FinishTestRaw

func (c *Client) FinishTestRaw(id string, body *bytes.Buffer) (*MsgRS, error)

FinishTestRaw finishes test in RP accepting body as array of bytes

func (*Client) GetFiltersByName

func (c *Client) GetFiltersByName(name string) (*FilterPage, error)

GetFiltersByName retrieves filter by its name

func (*Client) GetLaunches

func (c *Client) GetLaunches() (*LaunchPage, error)

GetLaunches retrieves latest launches

func (*Client) GetLaunchesByFilter

func (c *Client) GetLaunchesByFilter(filter map[string]string) (*LaunchPage, error)

GetLaunchesByFilter retrieves launches by filter

func (*Client) GetLaunchesByFilterName

func (c *Client) GetLaunchesByFilterName(name string) (*LaunchPage, error)

GetLaunchesByFilterName retrieves launches by filter name

func (*Client) GetLaunchesByFilterString

func (c *Client) GetLaunchesByFilterString(filter string) (*LaunchPage, error)

GetLaunchesByFilterString retrieves launches by filter as string

func (*Client) MergeLaunches

func (c *Client) MergeLaunches(rq *MergeLaunchesRQ) (*LaunchResource, error)

MergeLaunches merge two launches

func (*Client) SaveLog

func (c *Client) SaveLog(log *SaveLogRQ) (*EntryCreatedRS, error)

SaveLog attaches log in RP

func (*Client) SaveLogMultipart

func (c *Client) SaveLogMultipart(log *SaveLogRQ, files map[string][]os.File) (*EntryCreatedRS, error)

SaveLog attaches log in RP

func (*Client) StartChildTest

func (c *Client) StartChildTest(parent string, item *StartTestRQ) (*EntryCreatedRS, error)

StartChildTest starts new test in RP

func (*Client) StartChildTestRaw

func (c *Client) StartChildTestRaw(parent string, body *bytes.Buffer) (*EntryCreatedRS, error)

StartChildTestRaw starts new test in RP accepting request body as array of bytes

func (*Client) StartLaunch

func (c *Client) StartLaunch(launch *StartLaunchRQ) (*EntryCreatedRS, error)

StartLaunch starts new launch in RP

func (*Client) StartLaunchRaw

func (c *Client) StartLaunchRaw(body *bytes.Buffer) (*EntryCreatedRS, error)

StartLaunchRaw starts new launch in RP with body in form of bytes buffer

func (*Client) StartTest

func (c *Client) StartTest(item *StartTestRQ) (*EntryCreatedRS, error)

StartTest starts new test in RP

func (*Client) StartTestRaw

func (c *Client) StartTestRaw(body *bytes.Buffer) (*EntryCreatedRS, error)

StartTestRaw starts new test in RP accepting request body as array of bytes

func (*Client) StopLaunch

func (c *Client) StopLaunch(id string) (*MsgRS, error)

StopLaunch forces finishing launch

type EntryCreatedRS

type EntryCreatedRS struct {
	ID string `json:"id,omitempty"`
}

EntryCreatedRS payload

type FilterEntity

type FilterEntity struct {
	Field     string `json:"filtering_field"`
	Condition string `json:"condition"`
	Value     string `json:"value"`
}

FilterEntity - One piece of filter

type FilterOrder

type FilterOrder struct {
	SortingColumn string `json:"sorting_column"`
	Asc           bool   `json:"is_asc"`
}

FilterOrder - Describes ordering

type FilterPage

type FilterPage struct {
	Content []*FilterResource
	Response
}

FilterPage - GET Filter response model

type FilterResource

type FilterResource struct {
	ID              string                `json:"id"`
	Name            string                `json:"name"`
	Type            string                `json:"type"`
	Owner           string                `json:"owner"`
	Entities        []*FilterEntity       `json:"entities"`
	SelectionParams *FilterSelectionParam `json:"selection_parameters,omitempty"`
}

FilterResource - GET Filter response model

type FilterSelectionParam

type FilterSelectionParam struct {
	PageNumber int            `json:"page_number"`
	Orders     []*FilterOrder `json:"orders,omitempty"`
}

FilterSelectionParam - Describes filter ordering

type FinishExecutionRQ

type FinishExecutionRQ struct {
	EndTime     Timestamp `json:"end_time,omitempty"`
	Status      string    `json:"status,omitempty"`
	Description string    `json:"description,omitempty"`
	Tags        []string  `json:"tags,omitempty"`
}

FinishExecutionRQ payload representation

type FinishLaunchRS

type FinishLaunchRS struct {
	EntryCreatedRS
	Number int64  `json:"number,omitempty"`
	Link   string `json:"link,omitempty"`
}

FinishLaunchRS is finish execution payload

type FinishTestRQ

type FinishTestRQ struct {
	FinishExecutionRQ
	Retry bool `json:"retry,omitempty"`
}

FinishTestRQ payload representation

type LaunchMode

type LaunchMode string

LaunchMode - DEFAULT/DEBUG

type LaunchPage

type LaunchPage struct {
	Content []*LaunchResource
	Response
}

LaunchPage - GET Launch response model

type LaunchResource

type LaunchResource struct {
	ID                  string      `json:"id"`
	Name                string      `json:"name,omitempty"`
	Number              int64       `json:"number"`
	Description         string      `json:"description,omitempty"`
	StartTime           Timestamp   `json:"start_time,omitempty"`
	EndTime             Timestamp   `json:"end_time,omitempty"`
	Status              string      `json:"status,omitempty"`
	Tags                []string    `json:"tags,omitempty"`
	Mode                LaunchMode  `json:"mode,omitempty"`
	ApproximateDuration float32     `json:"approximateDuration,omitempty"`
	HasRetries          bool        `json:"hasRetries,omitempty"`
	Statistics          *Statistics `json:"statistics,omitempty"`
}

LaunchResource - GET Launch response model

type MergeLaunchesRQ

type MergeLaunchesRQ struct {
	Description             string     `json:"description,omitempty"`
	StartTime               *Timestamp `json:"start_time,omitempty"`
	EndTime                 *Timestamp `json:"end_time,omitempty"`
	ExtendSuitesDescription bool       `json:"extendSuitesDescription,omitempty"`
	Launches                []string   `json:"launches"`
	MergeType               MergeType  `json:"merge_type,omitempty"`
	Mode                    string     `json:"mode,omitempty"`
	Tags                    []string   `json:"tags,omitempty"`
	Name                    string     `json:"name,omitempty"`
}

MergeLaunchesRQ payload representation

type MergeType

type MergeType string

MergeType is type of merge: BASIC or DEEP

type MsgRS

type MsgRS struct {
	Msg string `json:"msg,omitempty"`
}

MsgRS successful operation response payload

type Parameter

type Parameter struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type Response

type Response struct {
	//Page is a slice of data returned by server
	Page struct {
		Number        int `json:"number,omitempty"`
		Size          int `json:"size,omitempty"`
		TotalElements int `json:"totalElements,omitempty"`
		TotalPages    int `json:"totalPages,omitempty"`
	} `json:"page,omitempty"`
}

Response is a representation of server response

type SaveLogRQ

type SaveLogRQ struct {
	ItemID  string    `json:"item_id,omitempty"`
	LogTime Timestamp `json:"time,omitempty"`
	Message string    `json:"message,omitempty"`
	Level   string    `json:"level,omitempty"`
}

SaveLogRQ payload representation. Without attaches.

type StartLaunchRQ

type StartLaunchRQ struct {
	StartRQ
	Mode    string     `json:"mode"`
	Rerun   bool       `json:"mode,omitempty"`
	RerunOf *uuid.UUID `json:"rerunOf,omitempty"`
}

StartLaunchRQ payload representation

type StartLaunchRS

type StartLaunchRS struct {
	ID string `json:"id,omitempty"`
}

StartLaunchRS payload

type StartRQ

type StartRQ struct {
	UUID        *uuid.UUID   `json:"uuid,omitempty"`
	Name        string       `json:"name,omitempty"`
	Description string       `json:"description,omitempty"`
	Attributes  []*Attribute `json:"attributes,omitempty"`
	StartTime   Timestamp    `json:"start_time,omitempty"`
}

StartRQ payload representation

type StartTestRQ

type StartTestRQ struct {
	StartRQ
	CodeRef    string       `json:"codeRef,omitempty"`
	Parameters []*Parameter `json:"parameters,omitempty"`
	UniqueID   string       `json:"uniqueId,omitempty"`
	TestCaseID string       `json:"testCaseId,omitempty"`
	LaunchID   string       `json:"launchUuid,omitempty"`
	Type       string       `json:"type,omitempty"`
	Retry      bool         `json:"retry,omitempty"`
	HasStats   string       `json:"hasStats,omitempty"`
}

StartTestRQ payload representation

type Statistics

type Statistics struct {
	Executions *struct {
		Total  string `json:"total,omitempty"`
		Passed string `json:"passed,omitempty"`
		Failed string `json:"failed,omitempty"`
	} `json:"executions,omitempty"`
	Defects *struct {
		Product       map[string]int `json:"product_bug,omitempty"`
		Automation    map[string]int `json:"automation_bug,omitempty"`
		System        map[string]int `json:"system_issue,omitempty"`
		ToInvestigate map[string]int `json:"to_investigate,omitempty"`
		NotDefect     map[string]int `json:"no_defect,omitempty"`
	} `json:"defects,omitempty"`
}

Statistics is a execution stat details

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp is a wrapper around Time to support Epoch milliseconds

func (*Timestamp) MarshalJSON

func (rt *Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON converts Epoch milliseconds (timestamp) to appropriate object

func (*Timestamp) UnmarshalJSON

func (rt *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON converts Epoch milliseconds (timestamp) to appropriate object

Jump to

Keyboard shortcuts

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