core: Fix TestContext2Apply_compute

The testDiffFn doesn't include "compute" in the diff it produces and so
it no longer appears in the shimmed output.

This is just a quirk of this weird mock implementation; real providers
always copy all of the values from thec config into the diff before adding
in any other changes.
This commit is contained in:
Martin Atkins 2018-09-25 16:05:06 -07:00
parent e6f8b51111
commit 74ffebe8ea
2 changed files with 36 additions and 1 deletions

View File

@ -2075,6 +2075,42 @@ func TestContext2Apply_compute(t *testing.T) {
p := testProvider("aws")
p.ApplyFn = testApplyFn
p.DiffFn = testDiffFn
p.GetSchemaReturn = &ProviderSchema{
ResourceTypes: map[string]*configschema.Block{
"aws_instance": {
Attributes: map[string]*configschema.Attribute{
"num": {
Type: cty.Number,
Optional: true,
},
"compute": {
Type: cty.String,
Optional: true,
},
"compute_value": {
Type: cty.String,
Optional: true,
},
"foo": {
Type: cty.String,
Optional: true,
},
"id": {
Type: cty.String,
Computed: true,
},
"type": {
Type: cty.String,
Computed: true,
},
"value": { // Populated from compute_value because compute = "value" in the config fixture
Type: cty.String,
Computed: true,
},
},
},
},
}
ctx := testContext2(t, &ContextOpts{
Config: m,

View File

@ -431,7 +431,6 @@ aws_instance.bar:
aws_instance.foo:
ID = foo
provider = provider.aws
compute = value
num = 2
type = aws_instance
value = computed_value