component

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: MIT Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ComponentTester

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

ComponentTester is an helper user to run unit tests based on local GIT repositories

func CreateComponentTester

func CreateComponentTester(t *testing.T, lC util.LaunchContext) *ComponentTester

CreateComponentTester creates a new ComponentTester

func (*ComponentTester) AssertComponentsContains

func (t *ComponentTester) AssertComponentsContains(paths ...string) bool

AssertComponentsContains asserts that the fetched component folder contains at least the components identified by the provided ids

func (*ComponentTester) AssertComponentsContainsExactly

func (t *ComponentTester) AssertComponentsContainsExactly(ids ...string) bool

AssertComponentsContainsExactly asserts that the fetched component folder contains exactly the components identified by the provided ids

func (*ComponentTester) CheckFile

func (t *ComponentTester) CheckFile(u UsableComponent, file, desiredContent string)

CheckFile asserts than a usable component contains a file with the desirec content

func (*ComponentTester) CheckParameter

func (t *ComponentTester) CheckParameter(key, value string)

CheckParameter asserts that the template context contains the given parameter

func (*ComponentTester) CheckSpecificEnvVar

func (t *ComponentTester) CheckSpecificEnvVar(env model.EnvVars, key, value string)

CheckSpecificEnvVar asserts that an environment variable contains the value

func (*ComponentTester) CheckSpecificParameter

func (t *ComponentTester) CheckSpecificParameter(p model.Parameters, key, value string)

CheckSpecificParameter asserts that a parameter contains the value

func (*ComponentTester) CheckStack

func (t *ComponentTester) CheckStack(holder, stackName, composeContent string)

CheckStack asserts than the environment contains the stack, then check that the stack's component is usable and finally check that the stack containts the provide compose content .

func (*ComponentTester) Clean

func (t *ComponentTester) Clean()

Clean deletes all the content created locally during a test

func (*ComponentTester) ComponentCount

func (t *ComponentTester) ComponentCount() int

ComponentCount returns the number of components fetched into the component folder

func (*ComponentTester) CreateRep

func (t *ComponentTester) CreateRep(path string) *testRepo

CreateRep creates a new component folder corresponding to the given path

func (*ComponentTester) CreateRepDefaultDescriptor

func (t *ComponentTester) CreateRepDefaultDescriptor(path string) *testRepo

CreateRepDefaultDescriptor creates a new component folder corresponding to the given path and write into it an empty descriptor

func (*ComponentTester) Env

Env returns the environment built during the test

func (*ComponentTester) Init

func (t *ComponentTester) Init() error

Init initializes the ComponentTester and build the environment bases on the launch context used during the tester's creation.

func (*ComponentTester) RootContainsComponent

func (t *ComponentTester) RootContainsComponent(path string) bool

RootContainsComponent returns true the components tester contains the given path

type Manager

type Manager interface {
	Init(mainComponent model.Component) error
	Ensure() error
	Environment() *model.Environment
	TemplateContext() *model.TemplateContext
	ContainsFile(name string, in ...model.ComponentReferencer) MatchingPaths
	ContainsDirectory(name string, in ...model.ComponentReferencer) MatchingPaths
	Use(cr model.ComponentReferencer) (UsableComponent, error)
}

Manager manages the fetch and the templating of components used into a descriptor

func CreateComponentManager

func CreateComponentManager(lC util.LaunchContext, baseDir string) Manager

CreateComponentManager creates a new component manager

type MatchingPath

type MatchingPath interface {
	//Component gives the usable component wherin the searched content has been located
	Component() UsableComponent
	//RelativePath specifies the relatives path of the searched content into the usable component
	RelativePath() string
	//AbsolutePath specifies the absolute path of the searched content into the usable component
	AbsolutePath() string
}

MatchingPath represents the matching path of the searched content

type MatchingPaths

type MatchingPaths struct {
	//Paths holds the searched  results
	Paths []MatchingPath
}

MatchingPaths represents the matching paths of the searched content

func (MatchingPaths) Count

func (mp MatchingPaths) Count() int

Count returns the number of matching paths

func (MatchingPaths) JoinAbsolutePaths

func (mp MatchingPaths) JoinAbsolutePaths(separator string) string

JoinAbsolutePaths joins all the matching paths using the given separator

func (MatchingPaths) PrefixPaths

func (mp MatchingPaths) PrefixPaths(prefix string) []string

PrefixPaths returns the absolute mathcing paths prefixed with the given prefix

func (MatchingPaths) Release

func (mp MatchingPaths) Release()

Release deletes, if any, the templated paths returned

type ParentRef

type ParentRef struct {
	Comp                 model.Component
	ReferencedComponents *model.ReferencedComponents
}

ParentRef defines the reference to the descriptor's parent

func (ParentRef) Component

func (p ParentRef) Component() (model.Component, error)

Component returns the referenced component

func (ParentRef) ComponentName

func (p ParentRef) ComponentName() string

ComponentName returns the referenced component name

type ReferenceManager

type ReferenceManager struct {

	//usedReferences stores the references of all components used
	// into the parsed descriptors and all its parents
	UsedReferences *model.UsedReferences
	Orphans        *model.Orphans
	//referencedComponents stores the references of all components declared
	// into the parsed descriptors and all its parents
	ReferencedComponents *model.ReferencedComponents
	Parents              []ParentRef

	SortedFetchedComponents []string
	// contains filtered or unexported fields
}

ReferenceManager manages all the components declared and used into a descriptor

func CreateReferenceManager

func CreateReferenceManager(cm *manager) *ReferenceManager

CreateReferenceManager creates a new references manager

type UsableComponent

type UsableComponent interface {
	//Name returns the name of the component
	Name() string
	//Templated returns true is the component content has been templated
	Templated() bool
	//Release deletes the templated content.
	Release()
	//RootPath returns the absolute path of the, eventually templated, component
	RootPath() string
	//ContainsFile returns the matching path of the searched file
	ContainsFile(name string) (bool, MatchingPath)
	//ContainsDirectory returns the matching path of the searched directory
	ContainsDirectory(name string) (bool, MatchingPath)
}

UsableComponent Represent a component which can be used physically

Directories

Path Synopsis
scm
Package scm is the abstraction of all available SCM Manager allowing to fetch components.
Package scm is the abstraction of all available SCM Manager allowing to fetch components.
file
Package file implements the git connector used to fetch components from local repositories.
Package file implements the git connector used to fetch components from local repositories.
git
Package git implements the git connector used to fetch components repositories.
Package git implements the git connector used to fetch components repositories.

Jump to

Keyboard shortcuts

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