File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,13 @@ type TestProvider struct {
105
105
Store * ResourceStore
106
106
}
107
107
108
+ // NewProvider creates a new TestProvider for use in tests.
109
+ //
110
+ // If you provide an empty or nil *ResourceStore argument this is equivalent to the provider
111
+ // not having provisioned any remote objects prior to the test's events.
112
+ //
113
+ // If you provide a *ResourceStore containing values, those cty.Values represent remote objects
114
+ // that the provider has 'already' provisioned and can return information about immediately in a test.
108
115
func NewProvider (store * ResourceStore ) * TestProvider {
109
116
if store == nil {
110
117
store = & ResourceStore {
@@ -381,6 +388,10 @@ func (provider *TestProvider) CloseEphemeralResource(providers.CloseEphemeralRes
381
388
382
389
// ResourceStore manages a set of cty.Value resources that can be shared between
383
390
// TestProvider providers.
391
+ //
392
+ // A ResourceStore represents the remote objects that a test provider is managing.
393
+ // For example, when the test provider gets a ReadResource request it will search
394
+ // the store for a resource with a matching ID. See (*TestProvider).ReadResource.
384
395
type ResourceStore struct {
385
396
mutex sync.RWMutex
386
397
You can’t perform that action at this time.
0 commit comments