provider

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchResources

func FetchResources[T types.Provider](ctx context.Context, t *testing.T, providers []T, name string) []model.Resource

func FetchStats added in v0.0.27

func FetchStats() map[string]int

Types

type FakeProvider

type FakeProvider struct {
	// ID is used for prefixes on resource types and identifiers
	ID string

	Foo FakeProviderResourceConfig
	Bar FakeProviderResourceConfig
}

FakeProvider provides mechanisms to test systems that require providers Has facilities for variable resource counts, returning errors, and artificial delay

func (*FakeProvider) AccountId added in v0.1.0

func (p *FakeProvider) AccountId() string

func (*FakeProvider) FetchFunctions

func (p *FakeProvider) FetchFunctions() map[string]types.FetchFunc

func (*FakeProvider) String

func (p *FakeProvider) String() string

func (*FakeProvider) TotalRuns

func (p *FakeProvider) TotalRuns() int

type FakeProviderResourceConfig

type FakeProviderResourceConfig struct {
	// Count is the number of resource returned by the fetch function
	Count int

	// ErrorAfterCount sets the error that the fetch function returns after sending the `Count` resources
	ErrorAfterCount error

	// DelayBefore sets a sleep duration before writing to the output channel
	DelayBefore time.Duration
	// contains filtered or unexported fields
}

FakeProviderResourceConfig stores configuration on a specific type for this fake provider

func (*FakeProviderResourceConfig) RunCount

func (c *FakeProviderResourceConfig) RunCount() int

RunCount returns the number of completed runs the fetch function has made, even if it errors out. This is useful for determining when the fetch function has returned

Jump to

Keyboard shortcuts

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