coreengine

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

README

Core Engine

Internal core-engine code to manage test execution, test status and results reporting

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvailableTests

func GetAvailableTests() *[]TestDescriptor

GetAvailableTests - return the universe of available tests

func TestHandleFunc

func TestHandleFunc(td TestDescriptor, gd *GoDogTestTuple)

TestHandleFunc - adds the TestHandlerFunc to the handler map, keyed on the TestDescriptor

Types

type Category

type Category int

Category ...

const (
	RBAC Category = iota
	PodSecurityPolicies
	NetworkPolicies
	SecretsMgmt
	General
	ContainerRegistryAccess
	ImageScanning
	IAM
	KeyMgmt
	Authentication
	Storage
	InternetAccess
)

Category enum

func (Category) String

func (c Category) String() string

type GoDogTestTuple

type GoDogTestTuple struct {
	Handler TestHandlerFunc
	Data    *GodogTest
}

GoDogTestTuple ...

type GodogTest

type GodogTest struct {
	TestDescriptor       *TestDescriptor
	TestSuiteInitializer func(*godog.TestSuiteContext)
	ScenarioInitializer  func(*godog.ScenarioContext)
	FeaturePath          *string
}

GodogTest ...

type Group

type Group int

Group ... TODO: not sure if this is the correct name for this?

const (
	Kubernetes Group = iota
	CloudDriver
	CoreEngine
)

Group enum

func (Group) String

func (g Group) String() string

type Test

type Test struct {
	UUID           string          `json:"uuid,omitempty"`
	TestDescriptor *TestDescriptor `json:"test_descriptor,omitempty"`

	Status *TestStatus `json:"status,omitempty"`

	Results *bytes.Buffer
}

Test - structure to hold test data

type TestDescriptor

type TestDescriptor struct {
	Group    Group    `json:"group,omitempty"`
	Category Category `json:"category,omitempty"`
	Name     string   `json:"name,omitempty"`
}

TestDescriptor - struct to hold description of test, name, category, strictness?? etc.

type TestHandlerFunc

type TestHandlerFunc func(t *GodogTest) (int, *bytes.Buffer, error)

TestHandlerFunc ...

type TestRunner

type TestRunner interface {
	RunTest(t *Test) error
}

TestRunner ...

type TestStatus

type TestStatus int

TestStatus ..

const (
	Pending TestStatus = iota
	Running
	CompleteSuccess
	CompleteFail
	Error
)

TestStatus enum ...

func (TestStatus) String

func (s TestStatus) String() string

type TestStore

type TestStore struct {
	Tests       map[uuid.UUID]*[]*Test
	FailedTests map[TestStatus]*[]*Test
	Lock        sync.RWMutex
	AuditLog    *output.AuditLog
}

TestStore - holds the current test suite. TODO: still not sure about the structure. Below is: uuid -> pointer to array of pointers to tests this implies that we'd be setting a test run up with multiple "sub" test runs, with each run being identified by a uuid which is mapped to the array of tests I think this could be too complicated, and it's just a simple uuid -> test, i.e. the "test run" is a map of multiple entries, each uuid simply pointing to one test, i.e. uuid -> pointer to test (done ... simples :-) )

func NewTestManager

func NewTestManager() *TestStore

NewTestManager - create a new test manager, backed by TestStore

func (*TestStore) AddTest

func (ts *TestStore) AddTest(td TestDescriptor) *uuid.UUID

AddTest ...

func (*TestStore) ExecAllTests

func (ts *TestStore) ExecAllTests() (int, error)

ExecAllTests ...

func (*TestStore) ExecTest

func (ts *TestStore) ExecTest(uuid *uuid.UUID) (int, error)

ExecTest by UUID in this case, but could be name, category, etc. Probably need an ExecTests as well ...

func (*TestStore) GetTest

func (ts *TestStore) GetTest(uuid *uuid.UUID) (*[]*Test, error)

GetTest by UUID ...

func (*TestStore) RunTest

func (ts *TestStore) RunTest(t *Test) (int, error)

RunTest TODO: remove TestStore?

Jump to

Keyboard shortcuts

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