definition

package module
v0.0.0-...-e2f5efa Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: BSD-3-Clause Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StorageBurnRate int64 = 8
	MemoryBurnRate  int64 = 217
	CPUBurnRate     int64 = 1615
)

Variables

This section is empty.

Functions

func ConfigureGlobal

func ConfigureGlobal(conf config.Config) (err error)

ConfigureGlobal allows you to provide the global config for this library

func ConfigureGlobalFromViper

func ConfigureGlobalFromViper(v *viper.Viper) error

ConfigureGlobalFromViper allows you to tie in configuration for this library from viper.

func ConfigureGlobalLogger

func ConfigureGlobalLogger(conf config.Config, logger logrus.Ext1FieldLogger) (err error)

ConfigureGlobalLogger allows you to provide the global config for this library

func ExtractFiles

func ExtractFiles(def Definition) []string

ExtractFiles extracts the input files from the definition

func GetBurn

func GetBurn(def Definition) (int64, error)

Get the resource burn per second

func GetBurns

func GetBurns(def Definition) ([]int64, error)

func GetDist

func GetDist(def Definition) ([]*entity.ResourceDist, error)

GetDist gets the resource distribution

func GetEnvs

func GetEnvs(def Definition) ([]map[string]string, error)

GetEnvs gets the environment variables which will be supplied to each of the containers

func GetTests

func GetTests(def Definition, meta Meta) ([]command.Test, error)

GetTests gets all of the commands, for both provisioner and genesis. The genesis commands will be in dependency groups, so that res[n+1] is the set of commands which require the execution of the commands In res[n].

func GetTestsUnsafe

func GetTestsUnsafe(def Definition, meta Meta) ([]command.Test, error)

Types

type Commands

type Commands interface {
	// GetTests gets all of the commands, for both provisioner and genesis.
	// The genesis commands will be in dependency groups, so that
	// res[n+1] is the set of commands which require the execution of the commands
	// In res[n].
	GetTests(def Definition, meta Meta) ([]command.Test, error)

	// GetTestsUnsafe is like GetTests, but doesn't generate a cryptographic key pair for auth
	GetTestsUnsafe(def Definition, meta Meta) ([]command.Test, error)

	// GetEnvs gets the environment variables which will be supplied to each of the containers
	GetEnvs(def Definition) ([]map[string]string, error)

	// GetDist gets the resource distribution
	GetDist(def Definition) ([]*entity.ResourceDist, error)

	// Get the resource burn per second
	GetBurn(def Definition) (int64, error)

	GetBurns(def Definition) ([]int64, error)

	ExtractFiles(def Definition) []string
}

Commands is the interface of a parser that extracts commands from a definition

func NewCommands

func NewCommands(conf config.Config, logger logrus.Ext1FieldLogger) Commands

NewCommands creates a new command extractor from the given viper config

type Definition

type Definition struct {
	// ID is the test ID
	ID string

	// OrgID
	OrgID string

	Spec schema.RootSchema
}

Definition is the top level container for the test definition specification.

func JSON

func JSON(raw []byte) (out Definition, err error)

JSON takes a raw set of JSON bytes and de-serializes them to a Definition structure.

func SchemaANY

func SchemaANY(raw []byte) (Definition, error)

SchemaANY will first try yaml and then try JSON

func SchemaJSON

func SchemaJSON(raw []byte) (out Definition, err error)

SchemaJSON takes a raw set of JSON bytes and de-serializes them to a Definition structure from just the test spec.

func SchemaYAML

func SchemaYAML(raw []byte) (out Definition, err error)

SchemaYAML takes a raw set of YAML bytes and de-serializes them to a Definition structure from just the test spec.

func YAML

func YAML(raw []byte) (out Definition, err error)

YAML takes a raw set of YAML bytes and de-serializes them to a Definition structure.

type Meta

type Meta struct {
	// Files is the metadata of the files provided for the user. This field is optional.
	Files []common.Metadata `json:"files,omitempty"`

	// Domains are domain names for the created instances. This field is optional.
	Domains []string `json:"domains,omitempty"`

	Limits common.TestLimits `json:"limits,omitempty"`

	DockerAuth command.Credentials `json:"dockerAuth,omitempty"`

	Metrics settings.Metrics `json:"metrics,omitempty"`

	CloudDetails biome.CloudAccess `json:"cloudDetails,omitempty"`

	DebugMode bool `json:"debugMode,omitempty"`

	Labels map[string]string `json:"labels,omitempty"`
}

Meta is addition data for functionalities not covered in the scope of the test definition schema. Such as the data on the referenced files themselves

type MetaPlus

type MetaPlus struct {
	Meta
	DefinitionRaw []byte `json:"definitionRaw,omitempty"`
}

MetaPlus is the meta sent to the registrar API as the body for test execution. It contains extra parameters for optimization

Directories

Path Synopsis
biome
Package biome messages used to perform commands, transiting over RabbitMQ.
Package biome messages used to perform commands, transiting over RabbitMQ.
pkg
config
package config contains the structures used for configuration for this library
package config contains the structures used for configuration for this library
config/defaults
package defaults provides structures for the defaults of the test definition format
package defaults provides structures for the defaults of the test definition format
dsl

Jump to

Keyboard shortcuts

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