audit

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Probe

type Probe struct {
	Meta               map[string]interface{}
	Path               string
	ScenariosAttempted int
	ScenariosSucceeded int
	ScenariosFailed    int
	GivenNotMet        int
	Result             string
	Scenarios          map[int]*Scenario
	// contains filtered or unexported fields
}

Probe is passed through various functions to audit the probe's progress

func (*Probe) InitializeAuditor

func (e *Probe) InitializeAuditor(name string, tags []*messages.Pickle_PickleTag) *Scenario

InitializeAuditor creates a new audit entry for the specified scenario

func (*Probe) Write

func (e *Probe) Write()

type Scenario

type Scenario struct {
	Name   string
	Result string // Passed / Failed / Given Not Met
	Tags   []string
	Steps  map[int]*step
}

Scenario is used by scenario states to audit progress through each step

func (*Scenario) AuditScenarioStep

func (p *Scenario) AuditScenarioStep(stepName, description string, payload interface{}, err error)

AuditScenarioStep sets description, payload, and pass/fail based on err parameter. This function should be deferred to catch panic behavior, otherwise the audit will not be logged on panic

type SummaryState

type SummaryState struct {
	Meta           map[string]interface{}
	Status         string
	ProbesPassed   int
	ProbesFailed   int
	ProbesSkipped  int
	Probes         map[string]*Probe
	WriteDirectory string
}

SummaryState is a stateful object intended to hold all the high-level info about a probe execution

func NewSummaryState

func NewSummaryState(packName string, defaultLogger ...bool) (state SummaryState)

NewSummaryState creates a new SummaryState with default values. Optional second parameter allows default logger to be disabled

func (*SummaryState) GetProbeLog

func (s *SummaryState) GetProbeLog(name string) *Probe

GetProbeLog initializes or returns existing log probe for the provided test name

func (*SummaryState) LogPodName

func (s *SummaryState) LogPodName(n string)

LogPodName adds pod names to a list for user's debugging purposes

func (*SummaryState) LogProbeMeta

func (s *SummaryState) LogProbeMeta(name string, key string, value interface{})

LogProbeMeta accepts a test name with a key and value to insert to the meta logs for that test. Overwrites key if already present.

func (*SummaryState) PrintSummary

func (s *SummaryState) PrintSummary()

PrintSummary will print the current object state, formatted to JSON

func (*SummaryState) ProbeComplete

func (s *SummaryState) ProbeComplete(name string)

ProbeComplete takes an probe name and status then updates the summary & probe meta information

func (*SummaryState) SetProbrStatus

func (s *SummaryState) SetProbrStatus()

SetProbrStatus evaluates the current SummaryState state to set the Status

func (*SummaryState) WriteSummary

func (s *SummaryState) WriteSummary()

WriteSummary will write the summary to the audit directory

Jump to

Keyboard shortcuts

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