Skip to content

Commit 08e58fd

Browse files
committed
Fix saved plan test regressions, fixtures
1 parent 31cf55f commit 08e58fd

File tree

5 files changed

+127
-6
lines changed

5 files changed

+127
-6
lines changed

internal/backend/local/backend_local_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ func TestLocalRun_cloudPlan(t *testing.T) {
9090
configDir := "./testdata/apply"
9191
b := TestLocal(t)
9292

93-
_, configLoader, configCleanup := initwd.MustLoadConfigForTests(t, configDir)
93+
_, configLoader, configCleanup := initwd.MustLoadConfigForTests(t, configDir, "tests")
9494
defer configCleanup()
9595

96-
planPath := "../../cloud/cloudplan/testdata/plan-bookmark/bookmark.json"
96+
planPath := "./testdata/plan-bookmark/bookmark.json"
9797

9898
planFile, err := planfile.OpenWrapped(planPath)
9999
if err != nil {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"remote_plan_format": 1,
3+
"run_id": "run-GXfuHMkbyHccAGUg",
4+
"hostname": "app.terraform.io"
5+
}

internal/command/views/show_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
func TestShowHuman(t *testing.T) {
28-
redactedPath := "../../cloud/testdata/plan-json-basic/plan-redacted.json"
28+
redactedPath := "./testdata/plans/redacted-plan.json"
2929
redactedPlanJson, err := os.ReadFile(redactedPath)
3030
if err != nil {
3131
t.Fatalf("couldn't read json plan test data at %s for showing a cloud plan. Did the file get moved?", redactedPath)

internal/command/views/test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ func (t *TestHuman) Run(run *moduletest.Run, file *moduletest.File) {
188188
RelevantAttributes: attrs,
189189
}
190190

191-
var opts []jsonformat.PlanRendererOpt
191+
var opts []plans.Quality
192192
if !run.Verbose.Plan.CanApply() {
193-
opts = append(opts, jsonformat.CanNotApply)
193+
opts = append(opts, plans.NoChanges)
194194
}
195195
if run.Verbose.Plan.Errored {
196-
opts = append(opts, jsonformat.Errored)
196+
opts = append(opts, plans.Errored)
197197
}
198198

199199
renderer.RenderHumanPlan(plan, run.Verbose.Plan.UIMode, opts...)
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
{
2+
"plan_format_version": "1.1",
3+
"resource_drift": [],
4+
"resource_changes": [
5+
{
6+
"address": "null_resource.foo",
7+
"mode": "managed",
8+
"type": "null_resource",
9+
"name": "foo",
10+
"provider_name": "registry.terraform.io/hashicorp/null",
11+
"change": {
12+
"actions": [
13+
"create"
14+
],
15+
"before": null,
16+
"after": {
17+
"triggers": null
18+
},
19+
"after_unknown": {
20+
"id": true
21+
},
22+
"before_sensitive": false,
23+
"after_sensitive": {}
24+
}
25+
}
26+
],
27+
"relevant_attributes": [],
28+
"output_changes": {},
29+
"provider_schemas": {
30+
"registry.terraform.io/hashicorp/null": {
31+
"provider": {
32+
"version": 0,
33+
"block": {
34+
"description_kind": "plain"
35+
}
36+
},
37+
"resource_schemas": {
38+
"null_resource": {
39+
"version": 0,
40+
"block": {
41+
"attributes": {
42+
"id": {
43+
"type": "string",
44+
"description": "This is set to a random value at create time.",
45+
"description_kind": "plain",
46+
"computed": true
47+
},
48+
"triggers": {
49+
"type": [
50+
"map",
51+
"string"
52+
],
53+
"description": "A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.",
54+
"description_kind": "plain",
55+
"optional": true
56+
}
57+
},
58+
"description": "The `null_resource` resource implements the standard resource lifecycle but takes no further action.\n\nThe `triggers` argument allows specifying an arbitrary set of values that, when changed, will cause the resource to be replaced.",
59+
"description_kind": "plain"
60+
}
61+
}
62+
},
63+
"data_source_schemas": {
64+
"null_data_source": {
65+
"version": 0,
66+
"block": {
67+
"attributes": {
68+
"has_computed_default": {
69+
"type": "string",
70+
"description": "If set, its literal value will be stored and returned. If not, its value defaults to `\"default\"`. This argument exists primarily for testing and has little practical use.",
71+
"description_kind": "plain",
72+
"optional": true,
73+
"computed": true
74+
},
75+
"id": {
76+
"type": "string",
77+
"description": "This attribute is only present for some legacy compatibility issues and should not be used. It will be removed in a future version.",
78+
"description_kind": "plain",
79+
"deprecated": true,
80+
"computed": true
81+
},
82+
"inputs": {
83+
"type": [
84+
"map",
85+
"string"
86+
],
87+
"description": "A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.",
88+
"description_kind": "plain",
89+
"optional": true
90+
},
91+
"outputs": {
92+
"type": [
93+
"map",
94+
"string"
95+
],
96+
"description": "After the data source is \"read\", a copy of the `inputs` map.",
97+
"description_kind": "plain",
98+
"computed": true
99+
},
100+
"random": {
101+
"type": "string",
102+
"description": "A random value. This is primarily for testing and has little practical use; prefer the [hashicorp/random provider](https://registry.terraform.io/providers/hashicorp/random) for more practical random number use-cases.",
103+
"description_kind": "plain",
104+
"computed": true
105+
}
106+
},
107+
"description": "The `null_data_source` data source implements the standard data source lifecycle but does not\ninteract with any external APIs.\n\nHistorically, the `null_data_source` was typically used to construct intermediate values to re-use elsewhere in configuration. The\nsame can now be achieved using [locals](https://www.terraform.io/docs/language/values/locals.html).\n",
108+
"description_kind": "plain",
109+
"deprecated": true
110+
}
111+
}
112+
}
113+
}
114+
},
115+
"provider_format_version": "1.0"
116+
}

0 commit comments

Comments
 (0)