artifacts

package
v0.0.0-...-e58ac12 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package artifacts provides API for manage tests artifacts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NeedToSave

func NeedToSave() bool

NeedToSave returns true if any of saving artifact option envs is not empty.

Types

type Artifact

type Artifact interface {
	Name() string
	Kind() string
	Content() []byte
}

Artifact represents specific content

func New

func New(name, kind string, content []byte) Artifact

New creates new artifact with specific name, kind and content

type Config

type Config interface {
	SaveOption() SaveOption
	OutputPath() string
	SaveInAnyCase() bool
}

Config is configuration of artifacts manager

func ConfigFromEnv

func ConfigFromEnv() Config

ConfigFromEnv reads config options from environment variables.

type Finder

type Finder interface {
	Find() []Artifact
}

Finder finds artifacts

type Hook

type Hook interface {
	OnPresent(Artifact) Artifact
	OnPresented(Artifact)
	OnStart()
	OnFinish()
}

Hook calls when before artifact presents and after

func Archivator

func Archivator(c Config) Hook

Archivator hook for artifacts manager. Archives artifact content.

type Manager

type Manager interface {
	SaveArtifacts()
	Config() Config
}

Manager saves artifacts

func NewManager

func NewManager(c Config, factory PresenterFactory, finders []Finder, hooks []Hook) Manager

NewManager creates artifacts manager with specific parameters.

type Presenter

type Presenter interface {
	Present(artifact Artifact)
}

Presenter exports artifacts

type PresenterFactory

type PresenterFactory interface {
	Presenter(config Config) Presenter
	Hooks(config Config) []Hook
}

PresenterFactory creates artifact presenters and hooks based on config

func DefaultPresenterFactory

func DefaultPresenterFactory() PresenterFactory

DefaultPresenterFactory returns default presenter factory

type SaveOption

type SaveOption byte

SaveOption means how artifact will save / presented

const (
	//SaveAsFiles means that artifacts should be saved as files
	SaveAsFiles SaveOption = 2 << iota
	//SaveAsArchive means that artifacts should be saved as archive
	SaveAsArchive
	//PrintToConsole means that artifacts should be printed to console
	PrintToConsole
)

Jump to

Keyboard shortcuts

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