mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
core: Fix TestContext2Apply_vars
Since this test sets its own special schema for aws_instance, its expected output must now be adjusted to only expect values that conform to that schema. The extraneous attributes like "type" which testDiffFn produces are no longer visible unless declared in schema. We also need to now declare "id" as a computed attribute in order for our state stringer shim to properly populate the formerly-special "ID".
This commit is contained in:
parent
d574a86d41
commit
c89f1fea63
@ -8263,10 +8263,10 @@ func TestContext2Apply_vars(t *testing.T) {
|
||||
t.Fatalf("err: %s", diags.Err())
|
||||
}
|
||||
|
||||
actual := strings.TrimSpace(state.String())
|
||||
expected := strings.TrimSpace(testTerraformApplyVarsStr)
|
||||
if actual != expected {
|
||||
t.Errorf("wrong result\n\ngot:\n%s\n\nwant:\n%s", actual, expected)
|
||||
got := strings.TrimSpace(state.String())
|
||||
want := strings.TrimSpace(testTerraformApplyVarsStr)
|
||||
if got != want {
|
||||
t.Errorf("wrong result\n\ngot:\n%s\n\nwant:\n%s", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ func contextFixtureApplyVars(t *testing.T) *contextTestFixture {
|
||||
c := testModule(t, "apply-vars")
|
||||
p := mockProviderWithResourceTypeSchema("aws_instance", &configschema.Block{
|
||||
Attributes: map[string]*configschema.Attribute{
|
||||
"id": {Type: cty.String, Computed: true},
|
||||
"foo": {Type: cty.String, Optional: true},
|
||||
"bar": {Type: cty.String, Optional: true},
|
||||
"baz": {Type: cty.String, Optional: true},
|
||||
|
@ -1017,7 +1017,6 @@ aws_instance.bar:
|
||||
bar = override
|
||||
baz = override
|
||||
foo = us-east-1
|
||||
type = aws_instance
|
||||
aws_instance.foo:
|
||||
ID = foo
|
||||
provider = provider.aws
|
||||
@ -1029,7 +1028,6 @@ aws_instance.foo:
|
||||
map.Foo = Bar
|
||||
map.Hello = World
|
||||
num = 2
|
||||
type = aws_instance
|
||||
`
|
||||
|
||||
const testTerraformApplyVarsEnvStr = `
|
||||
|
Loading…
Reference in New Issue
Block a user