faketask

package
v0.0.0-...-02c76fb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NilAndError

func NilAndError() resource.Task

NilAndError return a FakeTask that will simulate `return nil, err` case

Types

type FakeSwapper

type FakeSwapper struct {
	Status     string
	WillChange bool
	Error      error
}

FakeSwapper is a task that tracks its state so that it can change between calls to Apply

func Swapper

func Swapper() *FakeSwapper

Swapper creates a new stub swapper with an initial WillChange value of true

func (*FakeSwapper) Apply

Apply negates the current WillChange value set on struct and returns configured error

func (*FakeSwapper) Check

Check returns values set on struct

type FakeTask

type FakeTask struct {
	Status string `export:"status"`
	Level  resource.StatusLevel
	Error  error
}

FakeTask for testing things that require real tasks

func Error

func Error() *FakeTask

Error returns a FakeTask that will result in an error while checking or applying

func NoOp

func NoOp() *FakeTask

NoOp returns a FakeTask that doesn't have to do anything

func WillChange

func WillChange() *FakeTask

WillChange returns a FakeTask that will always change

func (*FakeTask) Apply

Apply returns values set on struct

func (*FakeTask) Check

Check returns values set on struct

type NilTask

type NilTask struct {
}

NilTask always return (nil, error) tuple on Check/Apply calls

func (*NilTask) Apply

Apply always raise error

func (*NilTask) Check

Check always raise error

Jump to

Keyboard shortcuts

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