teststruct

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 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 AlertMessage

type AlertMessage struct {
	TSname     string     `json:"tsname"`
	TSfile     string     `json:"tsfile"`
	TCname     string     `json:"tcname"`
	TCstatus   bool       `json:"tcres"`
	TStepfails []TestStep `json:"tstepfails"`
}

type AlertMessage2

type AlertMessage2 struct {
	TSname     TSHeader          `json:"ts"`
	TC         []TCHeader        `json:"tc"`
	TStepRecap []TStepAlertShort `json:"TStepAlertShort"`
}

type JSONStep

type JSONStep struct {
	Name       string                 `json:"name"`
	Config     configTestStructJson   `json:"config"`
	Probe      map[string]interface{} `json:"probe"`
	Assertions []string               `json:"assertions"`
	Loop       []string               `json:"loop"`
}

type JSONTestCase

type JSONTestCase struct {
	Name      string               `json:"name"`
	Config    configTestStructJson `json:"config"`
	Loop      []string             `json:"loop"`
	JsonSteps []JSONStep           `json:"steps"`
}

type JSONTestSuite

type JSONTestSuite struct {
	Config        configTestStructJson `json:"config"`
	Name          string               `json:"name"`
	JsonTestCases []JSONTestCase       `json:"testcases"`
	Vars          map[string][]string  `json:"vars"`
}

type ProbeConfigJsonRaw

type ProbeConfigJsonRaw map[string]string

type ProbeWrap

type ProbeWrap struct {
	Probe      probe.Probe   `json:"probe"`
	Frequency  time.Duration `json:"frequency"`  // time interval between two tests
	Retry      int           `json:"retry"`      // nb retry a test case if it is in failure.
	Retrydelay time.Duration `json:"retrydelay"` // delay between two retries
	Timeout    time.Duration `json:"timeout"`    // timeout on executor
}

func (ProbeWrap) Export

func (pw ProbeWrap) Export() ProbeWrapAPI

func (ProbeWrap) Run

func (pw ProbeWrap) Run() []probe.ProbeReturn

type ProbeWrapAPI

type ProbeWrapAPI struct {
	Probe      probe.Probe `json:"probe"`
	Frequency  string      `json:"frequency"`  // time interval between two tests
	Retry      int         `json:"retry"`      // nb retry a test case if it is in failure.
	Retrydelay string      `json:"retrydelay"` // delay between two retries
	Timeout    string      `json:"timeout"`    // timeout on executor
}

type Processing

type Processing struct {
	LastAttempt  time.Time
	Status       StepStatus
	VigieResults []VigieResult
	Issue        string
}

type Step

type Step map[string]interface{}

Step represents a Step

type StepAssertionDescribe

type StepAssertionDescribe struct {
	Assertions []string
}

type StepAssertions

type StepAssertions struct {
	Assertions []string `json:"assertions,omitempty"`
}

StepAssertions contains step assertions

type StepParam

type StepParam struct {
	Frequency  string `json:"frequency"`  // time interval between two test
	Retry      int    `json:"retry"`      // nb retry a test case if it is in failure.
	Retrydelay string `json:"retrydelay"` // delay between two retries
	Timeout    string `json:"timeout"`    // timeout on executor
}

type StepResultDescribe

type StepResultDescribe struct {
	StatusStr                string         `json:"status"`
	LastAttempt              time.Time      `json:"lastattempt"`            // UnixTimeNano si Freq <1sec
	LastPositiveTimeResult   time.Time      `json:"lastpositivetimeresult"` // UnixTimeNano si Freq <1sec
	LastPositiveVigieResults *[]VigieResult `json:"lastpositivevigieresults"`
	VigieResults             []VigieResult  `json:"vigieresults"`
	Details                  []string       `json:"details"`
	LastChange               time.Time      `json:"lastchange"`
}

type StepStatus

type StepStatus uint8
const (
	NotDefined StepStatus = iota
	Success
	Failure
	AssertFailure
	Timeout
	Error
)

func (StepStatus) IsSucess

func (ss StepStatus) IsSucess() bool

func (StepStatus) String

func (ss StepStatus) String() string

type TCAlertShort

type TCAlertShort struct {
	TCHeader
	TestSteps map[int64]TStepAlertShort `json:"teststeps"`
}

type TCDescribe

type TCDescribe struct {
	ID int `json:"id"`
	// Errors    int             `json:"errors"`
	Status string `json:"status"`
	// Failures  int             `json:"failures"`
	Name      *string         `json:"name"`
	TestSteps []TStepDescribe `json:"teststeps"`
}

type TCHeader

type TCHeader struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

type TSAlertShort

type TSAlertShort struct {
	TSHeader
	TestCases map[int64]TCAlertShort `json:"testcases"`
}

type TSDescribe

type TSDescribe struct {
	//	Errors         int          `json:"errors"`
	Status string `json:"status"`
	//	Failures       int          `json:"failures"`
	Name string `json:"name"`
	ID   int64  `json:"id"`
	//	TestCaseCount  int          `json:"testcasescount"`
	//	TestStepsCount int          `json:"teststepscount"`
	TestCases []TCDescribe `json:"testcases"`
}

type TSHeader

type TSHeader struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

type TStepAlertShort

type TStepAlertShort struct {
	Name    string   `json:"name"`
	ID      int64    `json:"id"`
	Status  string   `json:"status"`  // Status de la teststep
	Details []string `json:"details"` // Liste des messages result Assertions
}

type TStepDescribe

type TStepDescribe struct {
	Name      string             `json:"name"`
	StepProbe probe.Probe        `json:"probe"`
	StepD     StepParam          `json:"parameters"`
	StepResD  StepResultDescribe `json:"result"`
	StepAss   []string           `json:"assertions"`
}

type Task

type Task struct {
	TestSuite *TestSuite
	TestCase  *TestCase
	TestStep  *TestStep
}

func (*Task) LockAll

func (t *Task) LockAll()

func (*Task) RLockAll

func (t *Task) RLockAll()

func (*Task) RUnlockAll

func (t *Task) RUnlockAll()

func (*Task) UnlockAll

func (t *Task) UnlockAll()

func (*Task) WriteMetadataChanges

func (t *Task) WriteMetadataChanges(lastchg time.Time)

type TestCase

type TestCase struct {
	Mutex       sync.RWMutex
	Config      configTestStruct
	ID          int64
	Name        string
	Status      StepStatus
	CountChange uint
	LastChange  time.Time
	TestSteps   map[int64]*TestStep
}

toTestCase is a single test case with its result.

func (*TestCase) FailureCount

func (tc *TestCase) FailureCount() (failCount int)

func (*TestCase) GetStatus added in v0.4.0

func (tc *TestCase) GetStatus() (ss StepStatus)

func (*TestCase) SetStatus added in v0.4.0

func (tc *TestCase) SetStatus(newStatus StepStatus)

func (*TestCase) ToAlertShortTC

func (tc *TestCase) ToAlertShortTC() TCAlertShort

func (*TestCase) ToHeader

func (tc *TestCase) ToHeader() TCHeader

func (*TestCase) ToJSON

func (tc *TestCase) ToJSON() TCDescribe

func (*TestCase) UpdateStatus

func (tc *TestCase) UpdateStatus() bool

UpdateStatus change and return the TC ResultStatus Loop on each TSteps If one of the TSteps is KO => Set TC status to False

func (*TestCase) WithoutTStep added in v0.4.0

func (tc *TestCase) WithoutTStep() *TestCase

type TestStep

type TestStep struct {
	Mutex                    sync.RWMutex
	Name                     string
	ID                       int64
	Assertions               []assertion.Assert
	ProbeWrap                ProbeWrap
	Failures                 []string
	LastAttempt              time.Time
	LastPositiveTimeResult   time.Time
	VigieResults             []VigieResult
	LastPositiveVigieResults *[]VigieResult
	LastChange               time.Time
	ChangeCount              uint
	Status                   StepStatus
}

TestStep est constitué d'une Step ainsi que d'autres objets permettant l'exec et la traçabilité

func (*TestStep) AssertProbeResult

func (tStep *TestStep) AssertProbeResult(probeResult *probe.ProbeResult) (assertResults []assertion.AssertResult, success bool)

applyChecks apply checks on result, return true if all assertions are Success, false otherwise

func (*TestStep) GetLastPositiveResult

func (tStep *TestStep) GetLastPositiveResult() (vrs *[]VigieResult)

func (*TestStep) GetStatus

func (tStep *TestStep) GetStatus() (ss StepStatus)

func (*TestStep) ResponseTimeInflux

func (tStep *TestStep) ResponseTimeInflux() float64

responsetime return the duration time between the last call and the received response time is in second

func (*TestStep) ToStepAlertShort

func (tStep *TestStep) ToStepAlertShort() TStepAlertShort

func (*TestStep) ToTestStepDescribe

func (tStep *TestStep) ToTestStepDescribe() TStepDescribe

ToTestStepDescribe return a JSON API response

func (*TestStep) WriteResult

func (tStep *TestStep) WriteResult(pData *Processing) (stateChanged, alertEvent bool)

WriteResult Write all temp processing data during RunTestStep in a teststep

type TestSuite

type TestSuite struct {
	Mutex       sync.RWMutex
	Name        string
	ID          int64
	Status      StepStatus
	TestCases   map[int64]*TestCase
	LastChange  time.Time
	CountChange uint
	SourceFile  string // Public
}

func (*TestSuite) Failures

func (ts *TestSuite) Failures() (count int)

func (*TestSuite) SetStatus

func (ts *TestSuite) SetStatus(status StepStatus)

func (*TestSuite) ToAlertShortTS

func (ts *TestSuite) ToAlertShortTS() TSAlertShort

func (*TestSuite) ToAlertShortTSRec

func (ts *TestSuite) ToAlertShortTSRec() TSAlertShort

func (*TestSuite) ToHeader

func (ts *TestSuite) ToHeader() TSHeader

func (*TestSuite) ToJSON

func (ts *TestSuite) ToJSON() TSDescribe

func (*TestSuite) UnmarshalJSON

func (ts *TestSuite) UnmarshalJSON(data []byte) error

func (*TestSuite) UpdateStatus

func (ts *TestSuite) UpdateStatus()

func (*TestSuite) WithoutTC added in v0.4.0

func (ts *TestSuite) WithoutTC() TestSuite

type TotalAlertMessage

type TotalAlertMessage struct {
	Date       time.Time
	TestSuites map[int64]TSAlertShort
}

type UIDTest

type UIDTest struct {
	TestSuite TSHeader      `json:"testsuite"`
	TestCase  TCHeader      `json:"testcase"`
	TestStep  TStepDescribe `json:"teststep"`
}

type VigieResult

type VigieResult struct {
	ProbeResult       map[string]interface{}   `json:"probe_result"`
	AssertionResult   []assertion.AssertResult `json:"assertion_result"`
	Status            StepStatus               `json:"status"`
	StatusDescription string                   `json:"status_description"`
}

Jump to

Keyboard shortcuts

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