core: Schema for TestContext2Apply_outputDiffVars

The fixtures for this test assume some atypical arguments to the resources
and also need a provisioner schema.

This doesn't actually fix the test, but by fixing the schema/fixture this
exposes a problem that seems to exist in the main code, which will be
fixed in a subsequent commit.
This commit is contained in:
Martin Atkins 2018-05-25 12:06:56 -07:00
parent 4314c9e985
commit 02932b5a50
1 changed files with 18 additions and 0 deletions

View File

@ -5913,6 +5913,18 @@ func TestContext2Apply_Provisioner_ConnInfo(t *testing.T) {
p := testProvider("aws")
pr := testProvisioner()
p.GetSchemaReturn = &ProviderSchema{
ResourceTypes: map[string]*configschema.Block{
"aws_instance": {
Attributes: map[string]*configschema.Attribute{
"num": {Type: cty.String, Optional: true},
"compute": {Type: cty.String, Optional: true},
"compute_value": {Type: cty.String, Optional: true},
"dynamical": {Type: cty.String, Computed: true},
},
},
},
}
p.ApplyFn = func(info *InstanceInfo, s *InstanceState, d *InstanceDiff) (*InstanceState, error) {
if s.Ephemeral.ConnInfo == nil {
t.Fatalf("ConnInfo not initialized")
@ -5928,6 +5940,12 @@ func TestContext2Apply_Provisioner_ConnInfo(t *testing.T) {
}
p.DiffFn = testDiffFn
pr.GetConfigSchemaReturnSchema = &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"foo": {Type: cty.String, Optional: true},
},
}
pr.ApplyFn = func(rs *InstanceState, c *ResourceConfig) error {
conn := rs.Ephemeral.ConnInfo
if conn["type"] != "telnet" {