terraform: Test that validate gets a config for provisioners
This commit is contained in:
parent
abd5977988
commit
c8bc5658ab
|
@ -161,6 +161,12 @@ func TestContextValidate_provisionerConfig_good(t *testing.T) {
|
|||
config := testConfig(t, "validate-bad-prov-conf")
|
||||
p := testProvider("aws")
|
||||
pr := testProvisioner()
|
||||
pr.ValidateFn = func(c *ResourceConfig) ([]string, []error) {
|
||||
if c == nil {
|
||||
t.Fatalf("missing resource config for provisioner")
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
c := testContext(t, &ContextOpts{
|
||||
Config: config,
|
||||
Providers: map[string]ResourceProviderFactory{
|
||||
|
|
|
@ -15,6 +15,7 @@ type MockResourceProvisioner struct {
|
|||
|
||||
ValidateCalled bool
|
||||
ValidateConfig *ResourceConfig
|
||||
ValidateFn func(c *ResourceConfig) ([]string, []error)
|
||||
ValidateReturnWarns []string
|
||||
ValidateReturnErrors []error
|
||||
}
|
||||
|
@ -22,6 +23,9 @@ type MockResourceProvisioner struct {
|
|||
func (p *MockResourceProvisioner) Validate(c *ResourceConfig) ([]string, []error) {
|
||||
p.ValidateCalled = true
|
||||
p.ValidateConfig = c
|
||||
if p.ValidateFn != nil {
|
||||
return p.ValidateFn(c)
|
||||
}
|
||||
return p.ValidateReturnWarns, p.ValidateReturnErrors
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue