testing

package
v1.6.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProviderSchema = &providers.GetProviderSchemaResponse{
		Provider: providers.Schema{
			Block: &configschema.Block{
				Attributes: map[string]*configschema.Attribute{
					"data_prefix":     {Type: cty.String, Optional: true},
					"resource_prefix": {Type: cty.String, Optional: true},
				},
			},
		},
		ResourceTypes: map[string]providers.Schema{
			"test_resource": {
				Block: &configschema.Block{
					Attributes: map[string]*configschema.Attribute{
						"id":              {Type: cty.String, Optional: true, Computed: true},
						"value":           {Type: cty.String, Optional: true},
						"interrupt_count": {Type: cty.Number, Optional: true},
					},
				},
			},
		},
		DataSources: map[string]providers.Schema{
			"test_data_source": {
				Block: &configschema.Block{
					Attributes: map[string]*configschema.Attribute{
						"id":              {Type: cty.String, Required: true},
						"value":           {Type: cty.String, Computed: true},
						"interrupt_count": {Type: cty.Number, Computed: true},
					},
				},
			},
		},
	}
)

Functions

This section is empty.

Types

type ResourceStore

type ResourceStore struct {
	Data map[string]cty.Value
	// contains filtered or unexported fields
}

ResourceStore manages a set of cty.Value resources that can be shared between TestProvider providers.

func (*ResourceStore) Delete

func (store *ResourceStore) Delete(key string) cty.Value

func (*ResourceStore) Get

func (store *ResourceStore) Get(key string) cty.Value

func (*ResourceStore) Put

func (store *ResourceStore) Put(key string, resource cty.Value) cty.Value

type TestProvider

type TestProvider struct {
	Provider *tofu.MockProvider

	Interrupt chan<- struct{}

	Store *ResourceStore
	// contains filtered or unexported fields
}

TestProvider is a wrapper around tofu.MockProvider that defines dynamic schemas, and keeps track of the resources and data sources that it contains.

func NewProvider

func NewProvider(store *ResourceStore) *TestProvider

func (*TestProvider) ApplyResourceChange

func (*TestProvider) ConfigureProvider

func (*TestProvider) DataPrefix

func (provider *TestProvider) DataPrefix() string

func (*TestProvider) DataSourceCount

func (provider *TestProvider) DataSourceCount() int

func (*TestProvider) DataSourceString

func (provider *TestProvider) DataSourceString() string

func (*TestProvider) GetDataKey

func (provider *TestProvider) GetDataKey(id string) string

func (*TestProvider) GetResourceKey

func (provider *TestProvider) GetResourceKey(id string) string

func (*TestProvider) PlanResourceChange

func (*TestProvider) ReadDataSource

func (*TestProvider) ReadResource

func (*TestProvider) ResourceCount

func (provider *TestProvider) ResourceCount() int

func (*TestProvider) ResourcePrefix

func (provider *TestProvider) ResourcePrefix() string

func (*TestProvider) ResourceString

func (provider *TestProvider) ResourceString() string

func (*TestProvider) SetDataPrefix

func (provider *TestProvider) SetDataPrefix(prefix string)

func (*TestProvider) SetResourcePrefix

func (provider *TestProvider) SetResourcePrefix(prefix string)

Jump to

Keyboard shortcuts

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