mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-28 01:41:48 -06:00
terraform: implement Stop in the mock and shadow
This commit is contained in:
parent
60140b28f4
commit
d338a1ef88
@ -56,6 +56,9 @@ type MockResourceProvider struct {
|
||||
ReadDataDiffFn func(*InstanceInfo, *ResourceConfig) (*InstanceDiff, error)
|
||||
ReadDataDiffReturn *InstanceDiff
|
||||
ReadDataDiffReturnError error
|
||||
StopCalled bool
|
||||
StopFn func() error
|
||||
StopReturnError error
|
||||
DataSourcesCalled bool
|
||||
DataSourcesReturn []DataSource
|
||||
ValidateCalled bool
|
||||
@ -141,6 +144,18 @@ func (p *MockResourceProvider) Configure(c *ResourceConfig) error {
|
||||
return p.ConfigureReturnError
|
||||
}
|
||||
|
||||
func (p *MockResourceProvider) Stop() error {
|
||||
p.Lock()
|
||||
defer p.Unlock()
|
||||
|
||||
p.StopCalled = true
|
||||
if p.StopFn != nil {
|
||||
return p.StopFn()
|
||||
}
|
||||
|
||||
return p.StopReturnError
|
||||
}
|
||||
|
||||
func (p *MockResourceProvider) Apply(
|
||||
info *InstanceInfo,
|
||||
state *InstanceState,
|
||||
|
@ -107,6 +107,10 @@ func (p *shadowResourceProviderReal) Configure(c *ResourceConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *shadowResourceProviderReal) Stop() error {
|
||||
return p.ResourceProvider.Stop()
|
||||
}
|
||||
|
||||
func (p *shadowResourceProviderReal) ValidateResource(
|
||||
t string, c *ResourceConfig) ([]string, []error) {
|
||||
key := t
|
||||
@ -441,6 +445,11 @@ func (p *shadowResourceProviderShadow) Configure(c *ResourceConfig) error {
|
||||
return result.Result
|
||||
}
|
||||
|
||||
// Stop returns immediately.
|
||||
func (p *shadowResourceProviderShadow) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *shadowResourceProviderShadow) ValidateResource(t string, c *ResourceConfig) ([]string, []error) {
|
||||
// Unique key
|
||||
key := t
|
||||
|
Loading…
Reference in New Issue
Block a user