fixtures

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

package picker provided structures and method to manage injected variable system for Godog.

It allows an user to pick value into a store and inject them in steps through a variable replacement.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidInstance indicates that an object instance was expected but
	// did not matched expected types.
	ErrInvalidInstance = errors.New("invalid picked instance")

	// ErrUnknown indicates that on object should be available but
	// was not stored.
	ErrUnknown = errors.New("unknown instance")

	// ErrUnsupportedFixture indicates provided fixture kind
	// is not supported.
	ErrUnsupportedFixture = errors.New("unsupported fixture kind")
)

Functions

func Debug

func Debug() error

Debug activate debug logs.

func NoLog

func NoLog()

NoLog disable logging under Fatal level.

func Reset

func Reset() error

Reset matcher instance.

func ResetLog

func ResetLog()

ResetLog activate debug logs.

Types

type Fixtures

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

Fixtures manages fixtures files to help data initialisation for test.

It relies on picker.Picker manager.

func New

func New(store *picker.Store) *Fixtures

New initiates a fixtures manager instance using provided store.

func (Fixtures) LoadData

func (fix Fixtures) LoadData(fixturePath string) (err error)

LoadData parses yaml data manifest to stores declared data

func (Fixtures) LoadFromInstance

func (fix Fixtures) LoadFromInstance(fixturePath string, instanceKey string) error

func (Fixtures) LoadFromTags

func (fix Fixtures) LoadFromTags(tags []*messages.Pickle_PickleTag) error

func (Fixtures) LoadGooglePubsub

func (fix Fixtures) LoadGooglePubsub(gcp, fixturePath string) error

LoadGooglePubsub applies yaml pubsub manifest seed fixtures to picked google instance name.

func (Fixtures) LoadPostgres

func (fix Fixtures) LoadPostgres(db, fixturePath string) error

LoadPostgres applies sql seed fixtures to picked database name.

func (Fixtures) LoadYAMLManifest

func (fix Fixtures) LoadYAMLManifest(manifestPath string) (err error)

LoadYAMLManifest loads Manifest from path

func (Fixtures) NewTagLoader

func (fix Fixtures) NewTagLoader(s *godog.Scenario)

NewTagLoader initializes tag parsing process to load Manifest from `@manifest` tag.

func (Fixtures) Reset

func (fix Fixtures) Reset()

Reset resets fixture instance.

func (*Fixtures) WithBasePath

func (fix *Fixtures) WithBasePath(path string) *Fixtures

WithBasePath add a path element as prefix for any fixture file path.

type Kind

type Kind int

Kind of the loaded fixtures.

const (
	// Variables indicates fixtures to load data
	// using store.
	Variables Kind = iota + 1

	// Postgres indicates fixtures to load SQL
	// data for a picked postgres db instance.
	Postgres

	// Pubsub indicates fixtures to load PUBSUB
	// events for a picked pubsub instance.
	Pubsub

	// API indicates fixtures to load API
	// definitions background data.
	API
)

type Manifest

type Manifest struct {
	Variables []string                `yaml:"variables"`
	API       []*WithInstanceManifest `yaml:"api"`
	Pubsub    []*WithKindManifest     `yaml:"pubsub"`
	Database  []*WithKindManifest     `yaml:"database"`
}

Manifest represents a YAML fixture manifest.

func (*Manifest) Load

func (m *Manifest) Load(fixtures Fixtures) error

Load loads manifest using provided fixture instance.

type WithInstanceManifest

type WithInstanceManifest struct {
	Path     string `yaml:"path"`
	Instance string `yaml:"pickedInstanceKey"`
}

WithInstanceManifest represents a manifest part witch link a fixture file to a specific instance.

type WithKindManifest

type WithKindManifest struct {
	Kind     string `yaml:"kind"`
	Path     string `yaml:"path"`
	Instance string `yaml:"pickedInstanceKey"`
}

WithKindManifest represents manifest part providing fixtures requiring an instance kind.

Jump to

Keyboard shortcuts

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