Skip to content

Commit

Permalink
synchronize schema and test fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
jbardin committed Nov 18, 2024
1 parent c1f8152 commit 16fe12e
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions internal/command/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ func TestApply_plan_remoteState(t *testing.T) {
func TestApply_planWithVarFile(t *testing.T) {
varFileDir := testTempDir(t)
varFilePath := filepath.Join(varFileDir, "terraform.tfvars")
if err := ioutil.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil {
if err := os.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil {
t.Fatalf("err: %s", err)
}

Expand All @@ -878,6 +878,19 @@ func TestApply_planWithVarFile(t *testing.T) {
defer os.Chdir(cwd)

p := applyFixtureProvider()
p.GetProviderSchemaResponse = &providers.GetProviderSchemaResponse{
ResourceTypes: map[string]providers.Schema{
"test_instance": {
Block: &configschema.Block{
Attributes: map[string]*configschema.Attribute{
"id": {Type: cty.String, Computed: true},
"value": {Type: cty.String, Optional: true},
},
},
},
},
}

view, done := testView(t)
c := &ApplyCommand{
Meta: Meta{
Expand Down Expand Up @@ -1863,7 +1876,7 @@ func TestApply_varFileDefault(t *testing.T) {
defer testChdir(t, td)()

varFilePath := filepath.Join(td, "terraform.tfvars")
if err := ioutil.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil {
if err := os.WriteFile(varFilePath, []byte(applyVarFile), 0644); err != nil {
t.Fatalf("err: %s", err)
}

Expand Down Expand Up @@ -2660,8 +2673,8 @@ func applyFixturePlanFileMatchState(t *testing.T, stateMeta statemgr.SnapshotMet
func applyFixturePlanFileWithVariableValue(t *testing.T, value string) string {
_, snap := testModuleWithSnapshot(t, "apply-vars")
plannedVal := cty.ObjectVal(map[string]cty.Value{
"id": cty.UnknownVal(cty.String),
"ami": cty.StringVal("bar"),
"id": cty.UnknownVal(cty.String),
"value": cty.StringVal("bar"),
})
priorValRaw, err := plans.NewDynamicValue(cty.NullVal(plannedVal.Type()), plannedVal.Type())
if err != nil {
Expand Down

0 comments on commit 16fe12e

Please sign in to comment.